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

Latest release breaks SSR #91

Closed
danielstaleiny opened this issue Apr 13, 2018 · 4 comments
Closed

Latest release breaks SSR #91

danielstaleiny opened this issue Apr 13, 2018 · 4 comments

Comments

@danielstaleiny
Copy link

There is upstream issue with window is undefined crashing SSR react apps. Packages affected react-sizeme and everything build upon this.

ctrlplusb/react-sizeme#134
https://github.com/tsuyoshiwada/react-stack-grid/issues/47

@wnr
Copy link
Owner

wnr commented Apr 13, 2018

Hi and thanks for the report. This library needs a window context in order to do its job, and should therefore only be created when there is a window object available. What is the expected fix from this library?

As a side note, how can the window object be undefined? That seems very strange to me.

@danielstaleiny
Copy link
Author

Pleasure,
I understand the intention and I agree that this library should be used only within browser but we have serverside rendering. There is use case where react-sizeme is used on first render within serverside context. I don't expect react-sizeme or this library to calculate properties of the browser but it shouldn't crash either. The only job of this library in this context is not to crash and return undefined/null value, once browser takes over, do it's job.

I am already disabling this library on serverside but because those upstream libraries provide HOC I am just wrapping my components and waiting for browser to take over.

@danielstaleiny danielstaleiny changed the title New update breaks SSR Latest release breaks SSR Apr 13, 2018
@wnr
Copy link
Owner

wnr commented Apr 13, 2018

I see, thanks for the explanation. Yes, I agree that this would be a desired behaviour of React-resizeme and similar high-level APIs. However, the sole purpose of this library is to observe resize events of elements in a browser context - so I think that this library should not be invoked at all in other circumstances. I'm closing this issue, and hope that you will be able to find a solution upstream. Feel free to ping me in comments in the upstream issues if needed.

@wnr wnr closed this as completed Apr 13, 2018
@danielstaleiny
Copy link
Author

I understand and I agree. I will seek solution upstream, thank you for listening.

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

2 participants