react-infinite
react-infinite copied to clipboard
Universal rendering
If a component uses: useWindowAsScrollContainer
then we have a dependency on the window
object, which isn't available during server side rendering:
https://github.com/seatgeek/react-infinite/blob/a45928539cb275e9f7b9614996da917f589dd13b/src/react-infinite.jsx#L119
not sure if there is a way around this, right now i just define window globally and set window.innerHeight
to 0.
Yes, I think it's regrettable that that has a dependency on window
.
I can't think of a solution that wouldn't involve either window
or some object with the required properties of window
in some way. What API do you think would help you with this?
@mhahn forgot to mention you in that.
I haven't read the code, but maybe we could fallback to rendering a static list with simple pagination buttons (prev, next) if we are on the server?
An alternate fallback rendering method is not within the scope of this project.
If there is just an option to pass in an object that simulates whatever is
being pulled from window that would work for me. I want to avoid defining a
global window
object since that could leak into other requests.
On Thu, Jan 21, 2016 at 11:16 AM garetht [email protected] wrote:
An alternate fallback rendering method is not within the scope of this project.
— Reply to this email directly or view it on GitHub https://github.com/seatgeek/react-infinite/issues/117#issuecomment-173678691 .
Sounds good, I'll make a note to try and add an option like useWindowAsScrollContainer={someObject}
.
thanks, that would be awesome!
On Thu, Jan 21, 2016 at 2:31 PM garetht [email protected] wrote:
Sounds good, I'll make a note to try and add an option like useWindowAsScrollContainer={someObject}.
— Reply to this email directly or view it on GitHub https://github.com/seatgeek/react-infinite/issues/117#issuecomment-173736032 .
i actually went with something like this: https://github.com/erikras/react-redux-universal-hot-example/issues/769#issuecomment-169153596t. You can't reliably determine the window height from the request to the server, so i delay rendering this component until the client has mounted
@garetht would it be possible to move recomputeInternalStateFromProps
outside of getInitialState?
https://github.com/seatgeek/react-infinite/blob/master/src/react-infinite.jsx#L105
Hi! Do you guys still plan to make react-infinite w/ useWindowAsScrollContainer
compatible with server side rendering (or any work around)? Thanks
Hi guys. Are you planning to provide SSR support with react-infinite? Or it would be awesome if anyone could provide a work-around. Thanks.