-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Thanks for making this lib, it seems very useful!
But when I use it like this:
const { useParam } = createParam<{ id: string }>()
export function Screen() {
const [id] = useParam('id')
const myId = +id
const ready = !Number.isNaN(myId);
const { data, run } = useJsonStreaming<MyStreamType>({
url: `${process.env.NEXT_PUBLIC_API_URL}/stream`,
method: 'POST',
payload: { myId },
// manual: !enabled,
manual: true,
})
useEffect(() => {
if (ready) {
run()
}
}, [ready, run])It seems to retrigger on a re-render, like in an infinite loop.
What's the right way to prevent infinite retriggers (but still only trigger the first time when ready)? :)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels