I am using a REST API, I am storing the result in a variable and everything works perfectly I am displaying the result on the page …
then I am changing page and boom the variable is empty.
I can manage with the local storage but I would like to know if there is another solution, if I am missing something somewhere…
Thanks for your help
variables are emptied when you change page, unless you set it in local storage. Another option is to fill the variable once again on page load once you change the page
Please not that we have developped a feature to make you persist your variable on navigation, this will be available on the next release
is it cookie? Will there be SSR?
Now that our app is on SPA, its just a matter of not resseting it on our side (the navigation is client side).
- Local storage = persistent through browser navigation, tabs and open/close window
- Persistent on navigation = not reset (current behavior) when changing page client side
Being persistent on navigation will be the default behavior, but for retrocompatibility old variable will have this property set to false (but you will be able to change it).
This property will also be available for collection, so they will not be refetch on navigation as well if you want
We hope it will help you improve performances and use all the power to be an SPA now.
And bonus, we also update the fact that going to preview in the editor does not reset/refetch variables and collections, to help you work faster as well
Stay tuned for the next release