fix(home): reset auto-rotation timer on manual carousel selection#1118
Open
Khaostica wants to merge 1 commit into
Open
fix(home): reset auto-rotation timer on manual carousel selection#1118Khaostica wants to merge 1 commit into
Khaostica wants to merge 1 commit into
Conversation
The landing-page panel carousel (`Live work from the agents` / `Top agents by earnings`) used a fire-and-forget `setInterval` keyed on an empty dep array, so manual dot clicks were overridden by the next auto-tick. Switch to a `setTimeout` keyed on `activePanel` so any change — auto or manual — clears the pending timer and schedules a fresh 5s window. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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
The dual-panel carousel on the landing page (
Live work from the agents/Top agents by earnings) auto-rotates every 5s. Clicking a manual selector dot updatedactivePanelbut did not reset the rotation timer — a click 3 seconds into the cycle was overridden 2 seconds later when the auto-switch fired, snapping the panel back against the user's intent.Root cause:
The
setIntervalinHomePage.tsxwas created once on mount with an empty dependency array, running on its own schedule with no awareness of state changes that happened between ticks.Fix:
Switched to a
setTimeoutkeyed onactivePanel. Any change to the active panel — whether from the auto-rotation firing or a user click — tears down the pending timer and schedules a fresh 5-second one. Manual selections now get the full 5-second window before the next auto-switch.No new state was introduced;
activePanelis the only signal needed, and adding it to the dep array does the work. Click handlers remain plainsetActivePanel(...)calls.Behavior
/, wait 5sRelated Issues
None — surfaced during manual UX testing on the landing page.
Type of Change
Additional Video
Demonstrates the original bug:
https://github.com/user-attachments/assets/6bac49a7-17f4-4082-9016-58b9560f09c8
Checklist
npm run formatandnpm run lint:fixhave been runnpm run buildpasses