-
Notifications
You must be signed in to change notification settings - Fork 755
Fluentslider rapid-fire bug fix #2778
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fluentslider rapid-fire bug fix #2778
Conversation
WalkthroughTwo defensive improvements: LocalServer adds a guard check before assigning a hash to ensure the turn object exists, preventing runtime errors. FluentSlider refactors input handlers to dispatch value changes only on completion (blur or Enter key) rather than on every keystroke, with renamed handler methods and updated event bindings. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/client/LocalServer.ts (1)
135-138: Consider logging when turn is missing.The guard check prevents a runtime error when the turn doesn't exist, which is good defensive programming. However, silently ignoring this case might hide bugs. If a hash arrives for a non-existent turn, it could indicate an issue with turn synchronization or message ordering that should be investigated.
🔎 Proposed addition of warning log
const turn = this.turns[clientMsg.turnNumber]; if (turn) { turn.hash = clientMsg.hash; + } else { + console.warn( + `Cannot assign hash for turn ${clientMsg.turnNumber}: turn does not exist yet`, + ); }
📜 Review details
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/client/LocalServer.tssrc/client/components/FluentSlider.ts
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: andrewNiziolek
Repo: openfrontio/OpenFrontIO PR: 1007
File: resources/lang/de.json:115-115
Timestamp: 2025-06-02T14:27:37.609Z
Learning: For OpenFrontIO project: When localization keys are renamed in language JSON files, the maintainers separate technical changes from translation content updates. They wait for community translators to update the actual translation values rather than attempting to translate in the same PR. This allows technical changes to proceed while ensuring accurate translations from native speakers.
📚 Learning: 2025-12-13T14:58:29.645Z
Learnt from: scamiv
Repo: openfrontio/OpenFrontIO PR: 2607
File: src/core/execution/PlayerExecution.ts:271-295
Timestamp: 2025-12-13T14:58:29.645Z
Learning: In src/core/execution/PlayerExecution.ts surroundedBySamePlayer(), the `as Player` cast on `mg.playerBySmallID(scan.enemyId)` is intentional. Since scan.enemyId comes from ownerID() on an owned tile and playerBySmallID() only returns Player or undefined, the cast expresses a known invariant. The maintainers prefer loud failures (runtime errors) over silent masking (early returns with guards) for corrupted game state scenarios at trusted call sites.
Applied to files:
src/client/LocalServer.ts
🔇 Additional comments (4)
src/client/components/FluentSlider.ts (4)
87-97: LGTM! Clean separation of visual updates from value dispatch.The renamed method now only updates the visual state without dispatching events. The immediate clamping provides instant feedback to the user, and deferring the dispatch to completion (blur/Enter) prevents rapid-fire updates as intended.
99-102: LGTM! Clear centralization of completion dispatch.The new method provides a single point for dispatching value changes on completion, making the completion behavior explicit and easy to maintain.
104-109: LGTM! Enter key correctly completes editing.The Enter key now properly ends the editing session and dispatches the final value, consistent with standard form input behavior.
136-140: LGTM! Event bindings correctly implement the split behavior.The input event updates visuals via
handleNumberInput, and the blur event properly completes editing and dispatches the final value viahandleNumberComplete. The refactor is complete and consistent.
Description:
Describe the PR.
Modified FluentSlider(my code) to split number input handle to visual update(NumberInput) and dispatch value(NumberComplete)
updated the event flow to match them, will fix rapid-fire updates that seemed to glitch bots out.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
jackochess