Skip to content

Commit 50c261b

Browse files
committed
fix: Fix TypeScript error and lint warning in useLiveSuspenseQuery
Changed from checking result.status === 'disabled' to !result.isEnabled to avoid TypeScript error about non-overlapping types. Added eslint-disable comment for the isEnabled check since TypeScript's type inference makes it appear always true, but at runtime a disabled query could be passed via the 'any' typed parameter. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent d6bcaeb commit 50c261b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

packages/react-db/src/useLiveSuspenseQuery.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,8 @@ export function useLiveSuspenseQuery(
129129
const result = useLiveQuery(configOrQueryOrCollection, deps)
130130

131131
// SUSPENSE LOGIC: Throw promise or error based on collection status
132-
if (result.status === `disabled`) {
132+
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
133+
if (!result.isEnabled) {
133134
// Suspense queries cannot be disabled - throw error
134135
throw new Error(
135136
`useLiveSuspenseQuery does not support disabled queries. Use useLiveQuery instead for conditional queries.`

0 commit comments

Comments
 (0)