proteum 2.1.0-1 → 2.1.0-2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -390,7 +390,15 @@ import type ${appClassIdentifier}Client from '@/client/index';
390
390
 
391
391
  export type ClientContext = ${appClassIdentifier}Client["Router"]["context"];
392
392
 
393
- export const ReactClientContext = React.createContext<ClientContext>({} as ClientContext);
393
+ type GlobalClientContextStore = typeof globalThis & {
394
+ __proteumClientContexts?: Record<string, React.Context<ClientContext>>;
395
+ };
396
+
397
+ const globalClientContextStore = globalThis as GlobalClientContextStore;
398
+ const clientContexts = (globalClientContextStore.__proteumClientContexts ??= {});
399
+
400
+ export const ReactClientContext =
401
+ clientContexts['${appClassIdentifier}'] ?? (clientContexts['${appClassIdentifier}'] = React.createContext<ClientContext>({} as ClientContext));
394
402
  export default (): ClientContext => React.useContext<ClientContext>(ReactClientContext);`,
395
403
  );
396
404
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "proteum",
3
3
  "description": "LLM-first Opinionated Typescript Framework for web applications.",
4
- "version": "2.1.0-1",
4
+ "version": "2.1.0-2",
5
5
  "author": "Gaetan Le Gac (https://github.com/gaetanlegac)",
6
6
  "repository": "git://github.com/gaetanlegac/proteum.git",
7
7
  "license": "MIT",