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

withSingle / SmartForm on edit SSR is broken #2111

Open
eric-burel opened this issue Oct 29, 2018 · 2 comments
Open

withSingle / SmartForm on edit SSR is broken #2111

eric-burel opened this issue Oct 29, 2018 · 2 comments

Comments

@eric-burel
Copy link
Contributor

Hi,

withSingle SSR can sometimes be broken, especially when using the SmartForm in edition mode. One side renders a loader, while the other directly prints the form filled with data.

This could be related to either the server fetching the data before rendering (so the server renders the form but the client refetch the data and renders a loader) OR the client never showing the loader when data is cached (so server renders a loader and client renders a form), which is more probable.
I have not yet investigated this deeply so I can't tell which side renders what. I'll try to provide a minimal repro but this is should not be hard to reproduce in any app, just use a SmartForm that takes it's documentId from the route for example. If there is no issue, try wrapping it with another withSingle so the data is already cached when the form renders.

Most of the time it's not a big deal but you can get ugly result when rehydratation fails.

I did not found a satisfying solution either:

  • I can wrap the SmartForm with NoSsr in my app to quickfix
  • we could force withSingle to always render the loader at least once. Sounds a bit dirty...
  • there might be SSR features/packages I don't know about specifically built for this kind of issue? After all this can be common for any React component that fetches potentially cached data.
@eric-burel
Copy link
Contributor Author

Related to SSR: #2081

@eric-burel eric-burel mentioned this issue Nov 26, 2018
8 tasks
@eric-burel
Copy link
Contributor Author

To be tested with hooks after the new update

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants