Notes are not shown after refreshing the website


#1

Hello Guys,
I am observing a weird issue - Let’s say I have the app with DNS name myapp.com.

All notes which belong to the specific users are shown on the main page if the users is logged in. The issue occurs when I refresh the webpage - the list of notes is empty.

I performed some troubleshooting and it looks like it is caused by componentDidMount() component which sets the state. It is processed just one time during first loading of the webpage. When I reload the webpage it is not processed again so the list of notes is empty.

First question - is it only me who has that kind of issue?
I tested the same code but on some subpage, like myapp.com/mynotes and in this case everything works fine, even when I’m refreshing the page the notes are listed.

Any idea how to approach it? I’m stuck :frowning:


#2

Whoa that is really weird. So it works of a sub path but not on the root? And the request to the API is not made when you refresh the page?

Are you on Chrome? This sounds like an issue that might happen with progressive web apps (PWA).


#3

You can try out the hints here to see if they fix it for you.

https://github.com/facebook/create-react-app/blob/master/packages/react-scripts/template/README.md#opting-out-of-caching.


#4

Hey jayair,
I spent hours on analyzing the code as I saw that demo.serverless-stack.com has not that issue. I gave up, sorry. I’ve cloned the code, implemented my stuff again and it works fine… Shame but I don’t know why :slight_smile:


#5

Huh weird. Thanks for reporting back.