From e8422d276a51f63899b820fc9f78c833701819e2 Mon Sep 17 00:00:00 2001 From: Rhys Sullivan <39114868+RhysSullivan@users.noreply.github.com> Date: Tue, 5 May 2026 22:38:19 -0700 Subject: [PATCH] Document React scope context boundaries --- packages/react/src/api/scope-context.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/react/src/api/scope-context.tsx b/packages/react/src/api/scope-context.tsx index b44681287..d3b6b9edc 100644 --- a/packages/react/src/api/scope-context.tsx +++ b/packages/react/src/api/scope-context.tsx @@ -41,6 +41,7 @@ export function ScopeProvider(props: React.PropsWithChildren<{ fallback?: React. export function useScope(): ScopeId { const scope = React.useContext(ScopeContext); if (scope === null) { + // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant throw new Error("useScope must be used inside a ScopeProvider"); } return scope.id; @@ -53,6 +54,7 @@ export function useScope(): ScopeId { export function useScopeInfo(): ScopeInfo { const scope = React.useContext(ScopeContext); if (scope === null) { + // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant throw new Error("useScopeInfo must be used inside a ScopeProvider"); } return scope; @@ -66,6 +68,7 @@ export function useUserScope(): ScopeId { const stack = useScopeStack(); const innermost = stack[0]; if (!innermost) { + // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant throw new Error("useUserScope requires a non-empty scope stack"); } return innermost.id;