Skip to content

Commit

Permalink
Change the key of a global key (indicating the @emotion/react has bee…
Browse files Browse the repository at this point in the history
…n already loaded) to include the major version (#1981)
  • Loading branch information
Andarist committed Aug 21, 2020
1 parent c510d9d commit 58b2bbc
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/long-geckos-raise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@emotion/react': patch
---

Changed the key of the global flag that helps us identify that `@emotion/react` has been loaded more than once to include the current major version of `@emotion/react`.
3 changes: 2 additions & 1 deletion packages/react/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
import pkg from '../package.json'
export { withEmotionCache, CacheProvider } from './context'
export { jsx } from './jsx'
export { Global } from './global'
Expand All @@ -14,7 +15,7 @@ if (process.env.NODE_ENV !== 'production') {

if (isBrowser && !isJest) {
const globalContext = isBrowser ? window : global
const globalKey = '__EMOTION_REACT__'
const globalKey = `__EMOTION_REACT_${pkg.version.split('.')[0]}__`
if (globalContext[globalKey]) {
console.warn(
'You are loading @emotion/react when it is already loaded. Running ' +
Expand Down

0 comments on commit 58b2bbc

Please sign in to comment.