diff --git a/.changeset/pink-dancers-wash.md b/.changeset/pink-dancers-wash.md new file mode 100644 index 000000000..50605e281 --- /dev/null +++ b/.changeset/pink-dancers-wash.md @@ -0,0 +1,5 @@ +--- +'@emotion/cache': patch +--- + +Ensure that caches are not reused for different createCache calls diff --git a/packages/cache/src/index.js b/packages/cache/src/index.js index 39d66bf91..f1240043a 100644 --- a/packages/cache/src/index.js +++ b/packages/cache/src/index.js @@ -32,18 +32,18 @@ export type Options = { insertionPoint?: HTMLElement } -let getServerStylisCache = isBrowser - ? undefined - : weakMemoize(() => - memoize(() => { - let cache = {} - return name => cache[name] - }) - ) - const defaultStylisPlugins = [prefixer] let createCache = (options: Options): EmotionCache => { + let getServerStylisCache = isBrowser + ? undefined + : weakMemoize(() => + memoize(() => { + let cache = {} + return cache + }) + ) + let key = options.key if (process.env.NODE_ENV !== 'production' && !key) {