Skip to content
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

History API's state does not persist in deployed application #807

Open
jayendrasharan opened this issue Jun 24, 2020 · 0 comments
Open

History API's state does not persist in deployed application #807

jayendrasharan opened this issue Jun 24, 2020 · 0 comments

Comments

@jayendrasharan
Copy link

I have an issue in understanding the History API's state. The problem I am facing is the different behaviour between localhost and the actual deployed application.

So after I save something in state, and refresh the page I see two different behaviours.

  1. localhost keeps a copy post refresh
  2. production environment doesn't keep a copy after the refresh.

I have gone through the documentation,

https://developer.mozilla.org/en-US/docs/Web/API/History_API

it talks about, the state should be serializable and the max size. But I am storing exactly the same data, in both the environments, because it's the same flow of the application.

Could anyone help with this?

I am using react-router-dom, here is the code snippet:

// inside the component,
this.props.history.push('/some/route', {
  data: data
});


// in component did mount
if (this.props.location.state) {
  // do something with this.props.location.state
})
"react-router-dom": "^4.3.1",
"react-dom": "^16.8.6",
"react": "^16.8.6",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant