-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Website crashing when you refresh results or details page #92
Comments
This is what happens on our deployed website: However in browser forward/back buttons works correctly, and all airtable data is still reachable at endpoint: https://generation-change.netlify.com/.netlify/functions/getdata |
What we think is happening is the state gets lost. Solutions we have been thinking of trying are storing our data in local storage, looking into using the useContext hook, or looking into netlify redirects. Any suggestions welcome! |
You're right — as React is a front-end framework your state will not persist between sessions unless you set something up to capture it. AFAIK useContext will give you the same problem. I'd recommend using the sessionStorage API, which works much like localStorage. However, sessionStorage will only persist so long as your browser is open (including when you refresh), and will delete every time you close your browser. |
we could just use more of the router capabilities instead of relying on state and session storage so when you reload the url it works it our from the url. But if we are keeping all the airtable data in our state as well then it would mean we have to do more specific calls to airtable on every different page or still use session storage for the airtable data... |
I enter a postcode and get my results on the results page. If I refresh this, the page still displays but my results have gone (this is on localhost).
The text was updated successfully, but these errors were encountered: