Describe the bug
When the hook is initially disabled, it will never re-connect if enabled flips to true.
To Reproduce
const [useRealtime, setUseRealtime] = useState(false);
const { latestData, state: realtimeState } = useInngestSubscription({
refreshToken: tokenFn,
enabled: useRealtime,
});
// Enable after delay
useLayoutEffect(() => {
setTimeout(() => setUseRealtimeEffect(true), 2000);
});
console.log({ useRealtime, state });
Expected behavior
useRealtime: false, state: closed
useRealtime: true, state: connecting
useRealtime: true, state: active
Actual behavior
useRealtime: false, state: closed
useRealtime: true, state: closed
Code snippets / Logs / Screenshots
System info (please complete the following information):
- OS: linux
- npm package Version:
0.4.4
- Framework: next.js 15/react
- Platform: vercel