-
Notifications
You must be signed in to change notification settings - Fork 4
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
fix use node: protocol for async_hooks import #52
Conversation
@wootsbot is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
nilcoast#1 trying out the same thing here. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
This change allowed for backfilling with a stub (via some webpack aliasing), which I did so that it will work client side, but if the expectation is that this is ALWAYS fed from server side props then this library won't really work for the rare times I need client side hooks for behavior. |
The expectation is that the Flags SDK is used server-side. This is necessary to keep flags confidential, to avoid layout shift, and to be able to override flags using an encrypted cookie. If you need the value of the flags on the client you can pass their values as props. You can set up a context from a layout such that you can access the flags client-side in case multiple flags need it. You can also use the precompute pattern to make flags available to the whole application. The best approach depends on the type of the application you are building. |
@dferber90 yup, that's clear. My flags aren't secret and don't cause shift, but I get ya. For me a stateless solution worked best for now. I'll likely still bootstrap with vercel k/v until the docs and implementation on the vercel-sdk bake a bit more. You really should consider putting that server side caveat in the notes. Maybe it's clearer to others? |
This PR updates the import of the
async_hooks
module to use thenode:
protocol, as recommended by Node.js. This change aligns with best practices and ensures better compatibility and clarity in the codebase.Changes
import { AsyncLocalStorage } from "async_hooks";
toimport { AsyncLocalStorage } from "node:async_hooks";
.References
node:
protocolasync_hooks
moduleclose #51