Comments (5)
Comment by @brophdawg11 in discord.
defer doesnt re-show fallback on revalidations by design (see https://reactrouter.com/en/main/guides/deferred#when-does-the-suspense-fallback-render). When you stay o nthe same page and update search params it's a revalidation since you're already showing the loader data
This is no longer a limitation with the upcoming Single Fetch feature (https://remix.run/docs/en/main/guides/single-fetch) so you will have more control over re-falling back then via
Thank you for taking a look at this, @brophdawg11
This issue is primarily related to defer
and not to Suspense
. The issue persists regardless of whether Suspense
is used or not.
In the case of a search param navigation, the navigation won't execute (and hence not pass ANY data to useLoader
) until the last promise in loader is resolved.
Take the case where I pass three values to defer
: one is a sync value, the second is a promise that takes 3 seconds, and the third one takes 15 seconds. On the first navigation, this isn't a problem. I can show the sync data immediately, the second promise shortly after, and the slow promise after a while, with a spinner indicating that the data will be shown soon.
However, if I have a search param change, I cannot show any updated data for 15 seconds, not of the faster promise, and not even the new sync one! This is because the navigation will wait for that 15-second promise before it changes the URL and pass any new data to the useLoader
. It essentially behaves as if i would not have used defer
at all.
from remix.
@brophdawg11 here is a repro illustrating the issue without using Suspense at all: https://stackblitz.com/edit/mosattler-remix-repro-defer-search-params-x4jr7s?file=app%2Froutes%2F_index.tsx
from remix.
This issue is primarily related to
defer
and not to Suspense
In the case of a search param navigation, the navigation won't execute (and hence not pass ANY data to useLoader) until the last promise in loader is resolved.
Correct - this is proper behavior and is a design decision made for the handling of defer
as outlined in the docs. This will no longer be the case with single fetch so you can adopt that via future.unstable_singleFetch
if you really need to bypass this limitation of defer
.
from remix.
Alright, thank you for your help on this @brophdawg11
from remix.
I don't think is covered at all in the Remix docs anymore? I see a lot of comments regarding this confusion.
Hopefully React Router 7 consolidation will help get it all a bit clearer.
from remix.
Related Issues (20)
- [lazy route discovery]: Link component causes re-render when `discover` is not set to `none` HOT 1
- unstable_data response headers not set HOT 7
- Dev server not working properly on Safari browser HOT 4
- Top Suspense fallback not work HOT 8
- request.json() / request.text() doesn't resolve when "Content-Type" header is "application/json" HOT 7
- getInternalRouterError for missing POST endpoint instead of 405 Method Not Allowed HOT 9
- Loader function not executed after redirect to same url with different search params after update to remix v2 HOT 2
- Test setup/utils files importing server module gives: Server-only module referenced by client HOT 2
- Turbo responses are not compressed by Cloudflare
- cannot use non-standard HTTP methods within action HOT 4
- clientLoader hydration message shows in SPA that doesn't use clientLoader HOT 2
- Remix Serve calls installGlobals() HOT 3
- single-fetch `useLoaderData()` evaluates to `null` when redirecting to same URL when `shouldRevalidate` returns false HOT 2
- Error code: SIGILL, Chrome 128 (Aw, snap! Chrome error) Dev mode HOT 7
- Client builds are not deterministic in some cases HOT 1
- Failing Remix-run build on Vercel HOT 7
- docs - typo in createSessionStorage description
- cannot return HTTP 304 using unstable_singleFetch HOT 9
- [docs] $contactId vs $id inconsistency in website tutorial HOT 6
- Upgrade to v2.12.0 causing Vite "module externalized" warnings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from remix.