question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Client side state is not available in server side.

See original GitHub issue

When the state is updated in getServerSideProps or in getStaticProps, the HYDRATE action is called on client side to sync it with server side state, however the opposite is not happening. The server instance of the store always gets the initial state, not the client side state. What should be done in order to access client side state in getServerSideProps to render the page based on that state ?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
kirill-konshincommented, Jan 11, 2022

@kyun server ALWAYS have default state by design. You can use cookies to authenticate users and some server middlewares to cache portions of state for clients. This lib has nothing to do with this though, it’s app responsibility.

1reaction
kirill-konshincommented, Nov 7, 2021

It is completely out of scope of this package. You can sync state back to server by doing API calls and or using something like Yjs. Server state is only a seed to speed up client side initial rendering, nothing more. Documentation refers only to that initial rendering on client side when client state is indeed the same as server had.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Client side state is not hydrated from server on page reload
Server gets token via cookie and is authenticated; But when a new store is created on the client, it doesn't get the hydrated/updated...
Read more >
State Management In ASP.NET - C# Corner
Server -Side State Management is different from Client-Side State Management but the operations and working is somewhat the same in functionality ...
Read more >
Rather than using Session or view state, why don't we simply ...
Hi @BobDang-6703 , Session is used to store information required for a specific user session. The introduction of the Session object is to ......
Read more >
What is State Management in ASP.NET? Applications, Types ...
Client -side state management refers to the technique of storing data on the client's browser in the form of either cookies or hidden...
Read more >
Why view state is designed client side why not server side
View state is stored on client side ( HTML page in hidden fields ) not on server. i heared that there is a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found