Repository navigation
fix: useSmartPolling stops polling after the first re-render because useBountyStatus passes inline fetchFn/compareFn/onDataChange - #808
Open
Biglamar wants to merge 1 commit into
Conversation
|
@issue-solver-bot is attempting to deploy a commit to the chonilius' projects Team on Vercel. A member of the Team first needs to authorize it. |
Biglamar
marked this pull request as ready for review
October 18, 2026 22:12
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
In src/hooks/useSmartPolling.ts, fetchFn, compareFn and onDataChange are now held in refs that are updated on every render, so fetchData no longer changes identity when callers pass inline functions. I also removed the
hasInitializedguard from the main polling effect. The effect now recreates the interval whenever it re-runs, including whenenabledgoes from false to true. Before this, the first re-render ran the effect cleanup, which cleared the interval, and nothing recreated it. I added a regression test in src/hooks/useSmartPolling.test.tsx that uses inline callbacks and asserts polling continues past several intervals. I could not run any tests in this session.Changed files
src/hooks/useSmartPolling.test.tsxsrc/hooks/useSmartPolling.tsTest plan
Run
jest src/hooks/useSmartPolling.test.tsx src/hooks/useBountyStatus.test.tsx, plus the ClaimButton and BountyStatus tests. The new test, 'keeps polling across re-renders when callbacks are inline (#568)', asserts fetchFn is called more than twice after three timer advances. The existing enabled-toggle and backoff tests in the same file cover the removal of thehasInitializedguard.This PR was created as a draft by the issue solver bot. It will remain a
draft until repository CI passes.
Closes #568