griffel icon indicating copy to clipboard operation
griffel copied to clipboard

core: `DEFINITION_LOOKUP_TABLE` causes issues when multiple versions of @griffel/core are present

Open layershifter opened this issue 2 years ago • 3 comments

DEFINITION_LOOKUP_TABLE is a singleton used by mergeClasses() to merge classes sequences deterministically. The problem comes when there are multiple versions of @griffel/core that use different by reference DEFINITION_LOOKUP_TABLE constants.

It's more or less the same problem that React has with .createContext() calls (see https://github.com/facebook/react/issues/13346).

Repro on Stackblitz: https://stackblitz.com/edit/node-zerdgf?file=index.js

layershifter avatar Jul 11 '22 10:07 layershifter

Reported by partners (multiple versions of griffel in a bundle). The current idea is to have the DLT on window.

miroslavstastny avatar Aug 04 '22 09:08 miroslavstastny

Reported by partners (multiple versions of griffel in a bundle). The current idea is to have the DLT on window.

If using window to avoid singleton problem, wouldn't there be some issues when using SSR?

changyoungoh avatar Aug 17 '22 02:08 changyoungoh

Reported by partners (multiple versions of griffel in a bundle). The current idea is to have the DLT on window.

If using window to avoid singleton problem, wouldn't there be some issues when using SSR?

In SSR we will use global or will find another approach. We don't plan to regress in SSR support.

layershifter avatar Aug 17 '22 08:08 layershifter