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

Fix bug causing crash if localStorage not available #22

Merged
merged 1 commit into from
Dec 9, 2015

Conversation

victorquinn
Copy link
Contributor

Greetings,

I'm doing some server-side rendering and was getting this error when trying to build my app:

      if( localStorage[query_key] ){
          ^
ReferenceError: localStorage is not defined
    at Object.Lockr.get (/Users/victor/Development/LocationKit/data-mapping-tool/node_modules/lockr/lockr.js:70:11)
    at Object.module.exports.Object.defineProperty.value (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/src/reducers/UserReducer.js:8:21)
    at __webpack_require__ (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:19:1)
    at Object.module.exports.Object.defineProperty.value (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/src/components/App/App.js:11:53)
    at __webpack_require__ (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:19:1)
    at Object.<anonymous> (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/src/routes.js:9:39)
    at __webpack_require__ (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:19:1)
    at Object.module.exports.Object.defineProperty.value (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/src/handlers/main.js:6:26)
    at __webpack_require__ (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:19:1)
    at Object.<anonymous> (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/src/server.js:49:32)
    at __webpack_require__ (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:19:1)
    at module.exports.obj.__esModule.default (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:39:1)
    at Object.<anonymous> (/Users/victor/Development/LocationKit/data-mapping-tool/build/webpack:/webpack/bootstrap 308a988ba6b83a98b059:39:1)
    at Module._compile (module.js:425:26)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:313:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:138:18)
    at node.js:974:3

It only started recently as this version (0.8.3) didn't make it to npm until 16 days ago. Now my whole app crashes on build. Going back to 0.8.2 explicitly fixes the build as it takes me back in time before that commit was applied.

This PR should fix that issue and prevent crashes when running server-side.

tsironis added a commit that referenced this pull request Dec 9, 2015
Fix bug causing crash if localStorage not available
@tsironis tsironis merged commit 4e9af2d into tsironis:master Dec 9, 2015
@tsironis
Copy link
Owner

tsironis commented Dec 9, 2015

Thanks for the fix, @victorquinn! Really appreciate it. I'm going to release this as soon as possible.

@tsironis
Copy link
Owner

tsironis commented Dec 9, 2015

Fix available here but you can update with npm as always!

Thanks again for the fix.

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

Successfully merging this pull request may close these issues.

2 participants