#What is the best way to prevent a function running after its fetched and not loaded.

5 messages · Page 1 of 1 (latest)

vale laurel
#

I have data that I want to live in short term cache. After initial load, I want to run a function against that data but not run that function if the data is 'fetched' again.

#

What is the best way to prevent a function running after its fetched and not loaded.

fiery summit
#

what's the function doing? Since queries are idempotent, any transformation would likely need to be done again after a refetch

vale laurel
#

The function is loading PDF data into a 3rd party library from the blob data returned from a useQuery.

#

I don't want to cache the data long term, since it could be large. I'm thinking potentially I make the stale time infinite but make the cache time small .