Skip to content

Commit b11c779

Browse files
committed
patch(context): use internally
1 parent 44721e6 commit b11c779

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

packages/context/src/context.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ export function createContext<T extends Record<string, unknown>>(
2222
};
2323

2424
function useX(errorMessage?: string): T {
25+
const ctx = use();
2526
invariant(
26-
storage.ctx,
27+
ctx,
2728
defaultTo(errorMessage, 'Context was used after it was closed')
2829
);
29-
return storage.ctx as T;
30+
return ctx;
3031
}
3132

3233
function run<R>(ctxRef: Partial<T>, fn: (context: T) => R): R {

0 commit comments

Comments
 (0)