complete performance and reliability follow-ups
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
import { createStoreContainer } from "./index.ts";
|
||||
|
||||
let globalContainer: ReturnType<typeof createStoreContainer> | undefined;
|
||||
const storeGlobal = globalThis as typeof globalThis & {
|
||||
__wrnexusStoreContainer?: ReturnType<typeof createStoreContainer>;
|
||||
};
|
||||
|
||||
export function browserStoreContainer(hydration: Record<string, unknown> = {}) {
|
||||
if (!globalContainer) {
|
||||
@@ -17,7 +20,7 @@ export function browserStoreContainer(hydration: Record<string, unknown> = {}) {
|
||||
}
|
||||
},
|
||||
});
|
||||
(globalThis as any).__wrnexusStoreContainer = globalContainer;
|
||||
storeGlobal.__wrnexusStoreContainer = globalContainer;
|
||||
}
|
||||
return globalContainer;
|
||||
}
|
||||
@@ -25,5 +28,5 @@ export function browserStoreContainer(hydration: Record<string, unknown> = {}) {
|
||||
export async function resetBrowserStores() {
|
||||
await globalContainer?.dispose();
|
||||
globalContainer = undefined;
|
||||
delete (globalThis as any).__wrnexusStoreContainer;
|
||||
delete storeGlobal.__wrnexusStoreContainer;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user