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

Catch QuotaExceededError #75

Merged
merged 2 commits into from
Oct 7, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
lib
umd
node_modules
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this and put it in your ~/.gitignore instead.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This actually didn't get taken out, but I think it's fine to keep - it's part of standard .gitignore for Node per e.g. https://github.com/github/gitignore/blob/master/Node.gitignore. Most other JS projects ignore node_modules, per e.g. https://github.com/rackt/redux/blob/v3.0.4/.gitignore#L3.

Typically I think the user-global .gitignore is better suited for editor configuration rather than anything even slightly project-specific.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

testing

11 changes: 10 additions & 1 deletion modules/DOMStateStorage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import warning from 'warning'

/*eslint-disable no-empty */
const KeyPrefix = '@@History/'

Expand All @@ -6,7 +8,14 @@ function createKey(key) {
}

export function saveState(key, state) {
window.sessionStorage.setItem(createKey(key), JSON.stringify(state))
try {
window.sessionStorage.setItem(createKey(key), JSON.stringify(state))
} catch (error) {
if (error.name === 'QuotaExceededError')
return warning(null, 'sessionStore is not accessible in incognito mode')

throw error
}
}

export function readState(key) {
Expand Down