Skip to content

Commit

Permalink
patch(context): use internally
Browse files Browse the repository at this point in the history
  • Loading branch information
ealush committed Jun 14, 2022
1 parent 44721e6 commit b11c779
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions packages/context/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ export function createContext<T extends Record<string, unknown>>(
};

function useX(errorMessage?: string): T {
const ctx = use();
invariant(
storage.ctx,
ctx,
defaultTo(errorMessage, 'Context was used after it was closed')
);
return storage.ctx as T;
return ctx;
}

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

1 comment on commit b11c779

@vercel
Copy link

@vercel vercel bot commented on b11c779 Jun 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

vest-next – ./website

vest-next-ealush.vercel.app
vest-website.vercel.app
vest-next-git-latest-ealush.vercel.app
vest-next.vercel.app

Please sign in to comment.