geelen / react-snapshot

A zero-configuration static pre-renderer for React apps
MIT License
1.66k stars 105 forks source link

Error: Not implemented: window.scrollTo, #93

Closed kuongknight closed 6 years ago

kuongknight commented 6 years ago

I found error "Error: Not implemented: window.scrollTo", I fixed it by custom react-snapshot Then it is working, but react-snapshot render same with all page (without react render, only html with script tags)

stereobooster commented 6 years ago

Can you provide more clear description of the issue and reproducible example?

kuongknight commented 6 years ago

Try add componentWillMount() { window.scrollTo(0, 0) } to App.js and build (create-react-app)

stereobooster commented 6 years ago

If you are reporting about not implemented scrollTo. Yes this is known issue, because react-snapshot using jsdom which implements only subset of browser APIs. You can file an issue against jsdom as well.

From readme:

Is JSDOM gonna hold us back at some point?

Related https://github.com/geelen/react-snapshot/issues/40

kuongknight commented 6 years ago

We should make possible config beforeParse for jsdom.

stereobooster commented 6 years ago

Jsdom issue won't be fixed, see https://github.com/geelen/react-snapshot/pull/44#issuecomment-341292537. If this answers your question please close issue. Thanks