mirror of
https://github.com/stack-auth/stack.git
synced 2026-06-04 21:04:37 +08:00
Merge branch 'dev' into cl/hexclave-pr3
This commit is contained in:
commit
fe62423567
@ -571,3 +571,6 @@ A: Use `jiti` to import the user's config module, matching `stack config push`,
|
||||
|
||||
## Q: What is needed to put the legacy Fumadocs `docs/` app back into the Hexclave pnpm workspace?
|
||||
A: Add `docs` to `pnpm-workspace.yaml`, keep the package named `@hexclave/docs`, use `workspace:*` for `@hexclave/next` and `@hexclave/shared`, and update actual app imports from `@stackframe/stack`/`@stackframe/stack-shared` to `@hexclave/next`/`@hexclave/shared`. Docs app runtime env reads should prefer `NEXT_PUBLIC_HEXCLAVE_*`/`HEXCLAVE_*` while retaining legacy `STACK_*` fallbacks.
|
||||
|
||||
## Q: How should template React contexts avoid duplicate client-bundle context identities?
|
||||
A: Define exported provider contexts such as `StackContext` and `TranslationContext` through `createGlobal` from `@stackframe/stack-shared/dist/utils/globals`, not direct `React.createContext(...)` exports. That helper stores the React context under `globalThis[Symbol.for("__hexclave-globals")]`, so duplicated SDK bundles still share the same provider/consumer context object.
|
||||
|
||||
2
.github/assets/hexclave-header.svg
vendored
2
.github/assets/hexclave-header.svg
vendored
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
@ -1,8 +1,15 @@
|
||||
"use client";
|
||||
|
||||
import React from "react";
|
||||
import { createGlobal } from "@stackframe/stack-shared/dist/utils/globals";
|
||||
import type { StackClientApp } from "../lib/stack-app/apps/interfaces/client-app";
|
||||
|
||||
export const StackContext = React.createContext<null | {
|
||||
type StackContextValue = {
|
||||
app: StackClientApp<true>,
|
||||
}>(null);
|
||||
};
|
||||
|
||||
export const StackContext = createGlobal<React.Context<StackContextValue | null>>(
|
||||
"StackContext",
|
||||
() => React.createContext<StackContextValue | null>(null),
|
||||
);
|
||||
StackContext.displayName ??= "StackContext";
|
||||
|
||||
@ -1,11 +1,18 @@
|
||||
"use client";
|
||||
|
||||
import { createContext, useContext } from "react";
|
||||
import React from "react";
|
||||
import { createGlobal } from "@stackframe/stack-shared/dist/utils/globals";
|
||||
|
||||
export const TranslationContext = createContext<null | {
|
||||
type TranslationContextValue = {
|
||||
quetzalKeys: Map<string, string>,
|
||||
quetzalLocale: Map<string, string>,
|
||||
}>(null);
|
||||
};
|
||||
|
||||
export const TranslationContext = createGlobal<React.Context<TranslationContextValue | null>>(
|
||||
"TranslationContext",
|
||||
() => React.createContext<TranslationContextValue | null>(null),
|
||||
);
|
||||
TranslationContext.displayName ??= "TranslationContext";
|
||||
|
||||
export function TranslationProviderClient(props: {
|
||||
children: React.ReactNode,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user