diff --git a/packages/context/README.md b/packages/context/README.md index 4b461985289f..fb07a71c2fe3 100644 --- a/packages/context/README.md +++ b/packages/context/README.md @@ -1,3 +1,17 @@ # Context -**WIP**: This package is still a work in progress. +## About + +This package contains code for the global context used on the API side of a +Redwood application. It's automatically available in services, auth functions +and custom functions. + +## Serveful environments + +In serverful environments with Fastify the global context is injected by a +Fastify `onRequest` hook. + +## Serverless environments + +Babel is used to automatically wrap functions with code that makes the context +available. diff --git a/packages/context/src/store.ts b/packages/context/src/store.ts index a1860a084037..a688ed296d35 100644 --- a/packages/context/src/store.ts +++ b/packages/context/src/store.ts @@ -7,7 +7,9 @@ import type { GlobalContext } from './context' let CONTEXT_STORAGE: AsyncLocalStorage> /** - * This returns a AsyncLocalStorage instance, not the actual store + * This returns a AsyncLocalStorage instance, not the actual store. + * Should not be used by Redwood apps directly. The framework handles + * this. */ export const getAsyncStoreInstance = () => { if (!CONTEXT_STORAGE) {