Export build-time data to be accessible on client side during runtime #29961
Unanswered
vladimir-stornest
asked this question in
Help
Replies: 0 comments
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.
-
Hi, I have a plugin that sources data from an external API (in gatsby-node.js). I want to be able some of the data to be "cached" so it can be accessed on the client-end during runtime.
The reason is that I have a blog with 1000+ article pages. Their content rarely changes except for one "Recommended posts widget," which is the same for all articles. That widget changes very often, which means Gatsby will have to re-build all pages when it changes.
Instead of re-building all pages, I want to build all article pages without that widget and separately store the widget data in some kind of cache. Then, on client-end, I need to read that cache and populate the widget once the article is displayed using the useEffect hook.
I see there is a "setPluginStatus" action that persists data in Redux. If I use that during the build process (in gatsby-node.js), will that data be accessible on client-side during runtime?
If so, how can I access it? I couldn't find in the documentation how to access the data stored with setPluginStatus.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions