The createContext JSDoc told readers to reach for a module-scope
signal or store for app-wide state. With ssr: true a module is
evaluated once per process, so that state is shared by every request:
a store derived from a server function leaks one user's data into
another's render, and a module-scope signal has no owner to dispose
it. The 2.0 docs say the opposite, and the reference page is generated
from this JSDoc, so the site contradicted itself.
Also fix two smaller items in the same examples:
- The createContext and useContext @example blocks render <TodoList />,
whose stub returns nothing, so the examples fail tsc as written.
- The handleServerFunctionRequest @example imported from
"@solidjs/web/server-functions", which resolves to the client entry
under the browser condition; the function is exported from
"@solidjs/web/server-functions/server".
Closes #3390 (except the
useContextURL, see below).createContextguidanceThe JSDoc recommended a module-scope signal or store for app-wide state. Under
ssr: truea module is evaluated once per process, so that state is shared across requests, and the 2.0 docs advise the opposite. Since the reference page is generated from this JSDoc, the two contradicted each other. This uses the wording from the issue.Smaller items from the same issue
createContext/useContext@example: theTodoListstub had no return value, so the examples failtscas written. Addedreturn null;.handleServerFunctionRequest@example: imported from@solidjs/web/server-functions. Inpackages/web/package.jsonthat subpath resolves toserver-functions/dist/client.jsunder thebrowsercondition, while./server-functions/servermaps unconditionally to the server build, so the example now imports from@solidjs/web/server-functions/server.Not done
The fourth item,
useContext's@description https://docs.solidjs.com/reference/component-apis/use-contextbeing a 1.x URL, is left alone: every@descriptionin the 2.0 source points atdocs.solidjs.com/reference/..., includingcreate-contextandchildrendirectly around it, and the repo has no other docs host, so I could not tell what the intended 2.0 target is. Happy to update this one, and its neighbours if they are stale too, once you name the URL.Comment-only changes; no runtime code is touched.