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

sessionStorage not supported - used in reactjs #85

Closed
mnemanja opened this issue Nov 6, 2017 · 4 comments
Closed

sessionStorage not supported - used in reactjs #85

mnemanja opened this issue Nov 6, 2017 · 4 comments

Comments

@mnemanja
Copy link

mnemanja commented Nov 6, 2017

I'm using the sessionStorage in my constructor and that produces the error. I need it there or in the componentWillMount lifecycle to be able to react on time.

I need the sessionStorage in production. Can it be used with react-snapshot?

The error that I'm getting is the following:

🕷   Starting crawling http://localhost:58292/
Error: Uncaught [ReferenceError: sessionStorage is not defined]
    at reportException (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:58:24)
    at processJavaScript (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:130:7)
    at HTMLScriptElementImpl._eval (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:65:7)
    at C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:31:22
    at Object.check (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:89:11)
    at C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:108:12
    at wrappedEnqueued (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:255:16)
    at Request.request [as _callback] (C:\www\texlbl.npm-build\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:203:9)
    at Request.self.callback (C:\www\texlbl.npm-build\node_modules\request\request.js:186:22)
    at emitTwo (events.js:125:13) ReferenceError: sessionStorage is not defined
    at t.value (http://localhost:58292/static/js/main.a60316d9.js:1:405343)
    at f (http://localhost:58292/static/js/main.a60316d9.js:1:321692)
    at e.render (http://localhost:58292/static/js/main.a60316d9.js:1:327926)
    at e.read (http://localhost:58292/static/js/main.a60316d9.js:1:327669)
    at Object.renderToString (http://localhost:58292/static/js/main.a60316d9.js:1:330610)
    at t.render (http://localhost:58292/static/js/main.a60316d9.js:1:212061)
    at Object.<anonymous> (http://localhost:58292/static/js/main.a60316d9.js:1:206292)
    at t (http://localhost:58292/static/js/main.a60316d9.js:1:101)
    at Object.<anonymous> (http://localhost:58292/static/js/main.a60316d9.js:1:202712)
    at t (http://localhost:58292/static/js/main.a60316d9.js:1:101)
🔥 'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?
🕸   Finished crawling.

Process finished with exit code 0
@rhtm123
Copy link

rhtm123 commented Jan 12, 2018

Hey, @mnemanja. Have u found any solution to this problem?

@stereobooster
Copy link

You need either implement it in jsdom or switch from jsdom to real browser, like headless chrome.

From readme:

Is JSDOM gonna hold us back at some point?

Related #40

@stereobooster
Copy link

Jsdom issue won't be fixed, see #44 (comment). If this answers your question please close issue. Thanks

@mnemanja
Copy link
Author

Hi, It was on a project in my previous company a few months back.
I remember mocking the storage for tests, but not quite sure if I've used something special.

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

3 participants