Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/react/src/api/scope-context.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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;
Expand Down
Loading