diff --git a/packages/solid/src/client/core.ts b/packages/solid/src/client/core.ts index 5e1f252bb..c523b99d8 100644 --- a/packages/solid/src/client/core.ts +++ b/packages/solid/src/client/core.ts @@ -61,9 +61,11 @@ export interface Context extends ContextProviderComponent { * static fallback (theme, locale, frozen config). Outside any Provider, * `useContext` returns `defaultValue`. * - * If you want truly app-wide state, **don't use Context** — a module-scope - * signal/store *is* a global. Context is for scoping state to a subtree; - * that's why a Provider is required. + * Context is for state that belongs to a subtree, which includes app-wide + * state in an app that renders on the server: a value created inside a + * component is created once per request, and the Provider owns and disposes + * it. Module scope is shared by every request in the same process, so reserve + * it for constants. * * @param defaultValue optional default; only meaningful for primitive * fallbacks. Omit for any context carrying reactive state. @@ -87,6 +89,7 @@ export interface Context extends ContextProviderComponent { * function TodoList() { * const [todos, { addTodo }] = useContext(TodosContext); // typed as TodosCtx * // ... + * return null; * } * ``` * @@ -142,6 +145,7 @@ export function createContext(defaultValue?: T, options?: EffectOptions): Con * function TodoList() { * const [todos, { addTodo }] = useContext(TodosContext); // throws if no Provider * // ... + * return null; * } * ``` * diff --git a/packages/web/server-functions/src/server.ts b/packages/web/server-functions/src/server.ts index 13f7bb8fe..3ded0a013 100644 --- a/packages/web/server-functions/src/server.ts +++ b/packages/web/server-functions/src/server.ts @@ -3236,7 +3236,7 @@ function nativePromise(value) { * * @example * ```ts - * import { handleServerFunctionRequest } from "@solidjs/web/server-functions"; + * import { handleServerFunctionRequest } from "@solidjs/web/server-functions/server"; * import "virtual:solid-server-function-manifest"; * * // in the server's request handling: