-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use AsyncLocalStorage #40
base: main
Are you sure you want to change the base?
Changes from 8 commits
dbad162
3fa5239
a21b742
6a96611
09dd8c9
eb98fc3
d569b93
0c00b2e
721e78e
a34d492
d62f77a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
import { marked } from "marked"; | ||
// TODO: Find a lighter solution for syntax highlighting | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not related to ALS per se, but my CF Workers bundle is like 4MB because of this 🙃 |
||
import hljs from "highlight.js"; | ||
|
||
export async function convertToHtml(input: string) { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,10 +27,5 @@ | |
"dependencies": { | ||
"@changesets/changelog-git": "^0.1.14", | ||
"@changesets/cli": "^2.26.0" | ||
}, | ||
"pnpm": { | ||
"patchedDependencies": { | ||
"@remix-run/[email protected]": "patches/@[email protected]" | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { createCookieSessionStorage } from "@remix-run/cloudflare"; | ||
import { | ||
defineConfig, | ||
handleFetch as superflareHandleFetch, | ||
SuperflareAuth, | ||
SuperflareSession, | ||
type defineConfig, | ||
} from "superflare"; | ||
|
||
/** | ||
|
@@ -51,8 +51,7 @@ export async function handleFetch<Env extends { APP_KEY: string }>( | |
}, | ||
async () => { | ||
/** | ||
* We inject env and session into the Remix load context. | ||
* Someday, we could replace this with AsyncLocalStorage. | ||
* TODO: REMOVE THIS since we're using AsyncLocalStorage | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Or just deprecate it? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For me, I think I'll still put some separate things in the context for now. But a lot of people probably never should need to care about context. |
||
*/ | ||
const loadContext: SuperflareAppLoadContext<Env> = { | ||
session, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A limitation with ALS in CF Workers today is that custom thenables don't properly retain context: https://twitter.com/jasnell/status/1634764772121145344
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
woohoo! https://twitter.com/jasnell/status/1761066798039044416