You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I need to query only on the server but this data will not change so I do not need createServerData$data to re-fetch as the route changes. Initially I don't need a cache primitive (as shown in this discussion's answer). Some data lends itself to batch log updates (change log via polling or websocket).
Would it be useful to be able to mark the function as non-volatile? Given the same input, the output will always be the same. So, if this were turned on, it would not fetch more than once unless the parameters differed from its last fetch.
Seamed simple enough so I searched for the implementation and found the only assignment as: export const createServerData$ = createRouteData; in start/server/data.ts. So, I assume the implementation actually createRouteData but this is really compiler magic.. That must be what is going on. I believe I found the implementation here.
I see there are a few things going on in there. I assume I could simply create a wrapper function that takes createServerData$ or createRouteData and implements this non-volatile singleton behavior.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I need to query only on the server but this data will not change so I do not need
createServerData$
data to re-fetch as the route changes. Initially I don't need a cache primitive (as shown in this discussion's answer). Some data lends itself to batch log updates (change log via polling or websocket).Would it be useful to be able to mark the function as non-volatile? Given the same input, the output will always be the same. So, if this were turned on, it would not fetch more than once unless the parameters differed from its last fetch.
Seamed simple enough so I searched for the implementation and found the only assignment as:
export const createServerData$ = createRouteData;
in start/server/data.ts. So, I assume the implementation actually createRouteData but this is really compiler magic.. That must be what is going on. I believe I found the implementation here.I see there are a few things going on in there. I assume I could simply create a wrapper function that takes
createServerData$
orcreateRouteData
and implements this non-volatile singleton behavior.Beta Was this translation helpful? Give feedback.
All reactions