[fix] rename global
in @tldraw/state to avoid collissions (#1672)
We saw an issue on stackblitz where the `global` constant was causing a conflict (possibly because that environment was injecting its own `global`). Either way, perhaps `global` is a bit of a risky name—this PR renames `global` to `tldrawStateGlobal`. ### Change Type - [x] `patch`
This commit is contained in:
parent
81ee3381bf
commit
352c19fcac
1 changed files with 4 additions and 4 deletions
|
@ -1,15 +1,15 @@
|
|||
import { attach, detach } from './helpers'
|
||||
import { Child, Signal } from './types'
|
||||
|
||||
const globalKey = Symbol.for('__@tldraw/state__')
|
||||
const global = globalThis as { [globalKey]?: true }
|
||||
const tldrawStateGlobalKey = Symbol.for('__@tldraw/state__')
|
||||
const tldrawStateGlobal = globalThis as { [tldrawStateGlobalKey]?: true }
|
||||
|
||||
if (global[globalKey]) {
|
||||
if (tldrawStateGlobal[tldrawStateGlobalKey]) {
|
||||
console.error(
|
||||
'Multiple versions of @tldraw/state detected. This will cause unexpected behavior. Please add "resolutions" (yarn/pnpm) or "overrides" (npm) in your package.json to ensure only one version of @tldraw/state is loaded.'
|
||||
)
|
||||
} else {
|
||||
global[globalKey] = true
|
||||
tldrawStateGlobal[tldrawStateGlobalKey] = true
|
||||
}
|
||||
|
||||
class CaptureStackFrame {
|
||||
|
|
Loading…
Reference in a new issue