-
-
Notifications
You must be signed in to change notification settings - Fork 257
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
Avoid putting symbols in global to fix incompatibility with Temporal Sandbox. #4196
Conversation
🦋 Changeset detectedLatest commit: 13af68e The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
packages/effect/src/GlobalValue.ts
Outdated
@@ -46,6 +42,12 @@ const globalStore = (globalThis as any)[globalStoreId] as Map<unknown, any> | |||
* @since 2.0.0 | |||
*/ | |||
export const globalValue = <A>(id: unknown, compute: () => A): A => { | |||
if (!globalStore) { | |||
// @ts-expect-error | |||
globalThis[globalStoreId] = new Map() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
globalThis[globalStoreId] = new Map() | |
globalThis[globalStoreId] ??= new Map() |
Not sure if we want to overwrite if it already exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how can it already exist if globalStore
is undefined?
This pr is lit. Thank you @mikearnaldi and @mjameswh for helping me and getting this resolved. |
No description provided.