#Show Suspense fallback (spinner) every time the loader runs

1 messages · Page 1 of 1 (latest)

visual ore
#
  • When you enter the page, you see a spinner for about 15 seconds while the deferred promise resolves.
  • Then you see some stuff including a <form method="get"> with a search input.
  • When the search is submitted (to the same route), the loader runs and takes 15 seconds again, but this time the spinner isn't displayed.

I need the Suspense fallback (i.e. the spinner) to be displayed every time the form is submitted (i.e. every time the loader of this page runs), not only when the page loads for the first time.

Using navigation.state === 'submitting' won't help. I really need it to work at the Suspense fallback level because the logic in my real code depends on that for other reasons (I'm actually sending multiple promises to the browser and showing a different progress message as each promise resolves).

Any idea?

small gyro
vale field
#

Is the loader giving you the expected promise after the POST? If so, is your suspense/await written correctly and if it is, is your promise resolving faster than anticipated?

visual ore
visual ore
#

To be clear, my code works. What's happening is the default Remix behavior. I need some way to achieve a different behavior (i.e. show the promise fallback every time the loader runs, not just the first time).