-
-
Notifications
You must be signed in to change notification settings - Fork 940
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
serialization error handling, experimental async storage
- Loading branch information
Showing
7 changed files
with
57 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"solid-js": patch | ||
--- | ||
|
||
serialization error handling, experimental async storage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/// <reference types="node" /> | ||
import { AsyncLocalStorage } from "node:async_hooks"; | ||
import type { RequestEvent } from "../server"; | ||
export default function initializeServerStorage<T extends RequestEvent>(): AsyncLocalStorage<T>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { AsyncLocalStorage } from "node:async_hooks"; | ||
import type { RequestEvent } from "solid-js/web"; | ||
import { isServer, RequestContext } from "solid-js/web"; | ||
|
||
// using global on a symbol for locating it later and detaching for environments that don't support it. | ||
export default function initializeServerStorage<T extends RequestEvent>(): AsyncLocalStorage<T> { | ||
if (!isServer) throw new Error("Attempting to use server context in non-server build"); | ||
return ((globalThis as any)[RequestContext] = | ||
(globalThis as any)[RequestContext] || new AsyncLocalStorage<T>()); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.