Unified · Split
| @@ -41,6 +41,7 @@ export function ScopeProvider(props: React.PropsWithChildren<{ fallback?: React. · 40 unmodified lines | |||
| 41 | export function useScope(): ScopeId { | 41 | export function useScope(): ScopeId { |
| 42 | const scope = React.useContext(ScopeContext); | 42 | const scope = React.useContext(ScopeContext); |
| 43 | if (scope === null) { | 43 | if (scope === null) { |
| 44 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant | ||
| 44 | throw new Error("useScope must be used inside a ScopeProvider"); | 45 | throw new Error("useScope must be used inside a ScopeProvider"); |
| 45 | } | 46 | } |
| 46 | return scope.id; | 47 | return scope.id; |
| @@ -53,6 +54,7 @@ export function useScope(): ScopeId { · 6 unmodified lines | |||
| 53 | export function useScopeInfo(): ScopeInfo { | 54 | export function useScopeInfo(): ScopeInfo { |
| 54 | const scope = React.useContext(ScopeContext); | 55 | const scope = React.useContext(ScopeContext); |
| 55 | if (scope === null) { | 56 | if (scope === null) { |
| 57 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant | ||
| 56 | throw new Error("useScopeInfo must be used inside a ScopeProvider"); | 58 | throw new Error("useScopeInfo must be used inside a ScopeProvider"); |
| 57 | } | 59 | } |
| 58 | return scope; | 60 | return scope; |
| @@ -66,6 +68,7 @@ export function useUserScope(): ScopeId { · 7 unmodified lines | |||
| 66 | const stack = useScopeStack(); | 68 | const stack = useScopeStack(); |
| 67 | const innermost = stack[0]; | 69 | const innermost = stack[0]; |
| 68 | if (!innermost) { | 70 | if (!innermost) { |
| 71 | // oxlint-disable-next-line executor/no-try-catch-or-throw, executor/no-error-constructor -- boundary: React hook invariant | ||
| 69 | throw new Error("useUserScope requires a non-empty scope stack"); | 72 | throw new Error("useUserScope requires a non-empty scope stack"); |
| 70 | } | 73 | } |
| 71 | return innermost.id; | 74 | return innermost.id; |