Description
In useLiveInfiniteQuery, the dependency array is serialized for comparison using:
const depsKey = JSON.stringify(deps) // line 158
JSON.stringify throws a TypeError for values containing circular references. If a user passes a dependency with circular references, the entire component crashes with:
TypeError: Converting circular structure to JSON
Suggested Fix
Use a safer serialization approach or wrap in a try-catch with a descriptive error:
let depsKey: string
try {
depsKey = JSON.stringify(deps)
} catch {
throw new Error(
`useLiveInfiniteQuery: deps array contains values that cannot be serialized (e.g. circular references). ` +
`Ensure all dependency values are JSON-serializable.`
)
}
Impact
Low — circular references in deps are uncommon, but when it happens the error message gives no indication that the problem is in the deps array.
Description
In
useLiveInfiniteQuery, the dependency array is serialized for comparison using:JSON.stringifythrows aTypeErrorfor values containing circular references. If a user passes a dependency with circular references, the entire component crashes with:Suggested Fix
Use a safer serialization approach or wrap in a try-catch with a descriptive error:
Impact
Low — circular references in deps are uncommon, but when it happens the error message gives no indication that the problem is in the deps array.