Replies: 3 comments 1 reply
This comment has been hidden.
This comment has been hidden.
-
|
Thanks to @dadamssg for a sample POC implementation here: #14635 If this moves forward we can re-open that or use it as a starting point 👍 |
Beta Was this translation helpful? Give feedback.
0 replies
-
|
This could solve the problem we faced here (#14807 (reply in thread)) as well when trying to use |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
tl;dr
Background
Currently, having a
clientLoaderdefined in a route module automatically opts it out of single-fetch and requires a separate request because theclientLoadercould end up not calling theserverLoader(). This is perfect for use-cases like debouncing requests.However, often times
clientLoaders solely exist to enrich the server data with data only available on the client. Some examples include:In these cases, the
serverLoaderwill always be called and reducing network requests would be ideal. This is more impactful now that middleware has landed since it wouldn't be running again in a separate request.Proposal
A new
preloadflag to be optionally added toclientLoaders, similar to thehydrateflag. If this is set, the route loader will always participate in single-fetch. TheserverLoader()would return the data from the single-fetch request instead of initiating a new fetch to get the loader data.Alternatives
Currently, if you want the route to participate in single-fetch and enrich with client data you would need to do that in the route component.
Alternatively, this was discussed from the team previously:
Beta Was this translation helpful? Give feedback.
All reactions