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(debug): add bug work around #845

Merged
merged 2 commits into from
Nov 13, 2016
Merged
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
18 changes: 18 additions & 0 deletions src/lib/debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,25 @@ let _debug
const noop = () => undefined

if (process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// Heads Up!
// https://github.com/visionmedia/debug/pull/331
//
// debug now clears storage on load, grab the debug settings before require('debug').
// We try/catch here as Safari throws on localStorage access in private mode or with cookies disabled.
let DEBUG
try {
DEBUG = window.localStorage.debug
} catch (e) {
/* eslint-disable no-console */
console.warning('Semantic-UI-React could not enable debug.')
console.error(e)
/* eslint-enable no-console */
}

_debug = require('debug')

// enable what ever settings we got from storage
_debug.enable(DEBUG)
} else {
_debug = () => noop
}
Expand Down