karaokenite / karaokenite/karaokenite-react

Don't update local currentTime state unnecessarily

Open
#12 0 comments 0 reactions 0 assignees View on GitHub
area: game runtime good first issue status: accepting prs type: cleanup
Dominant language
TypeScript
Stars
9
Forks
3
PR merge metrics
No merged PRs in 30d

Description

Following #9: right now, `useTimeSynchronization` updates both the local `roomData.currentTime` _and_ the server state:

https://github.com/karaokenite/karaokenite-react/blob/6c26f5c1a7c2023cc05c900c5f69ed88a5b28bb4/src/pages/room/RoomEvents/useVideoControls/useTimeSynchronization.ts#L16-L20

Nothing in local UI should actually subscribes to `currentTime`... and even if we do add something that does, we already receive updates from the server whenever `currentTime` or any other room data updates.

Proposal: as a performance improvement, `emit` the new `currentTime` to the server directly, without also setting it in React state.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with src/pages/room/RoomEvents/useVideoControls/useTimeSynchronization.ts at the linked lines, and inspect how the hook updates roomData.currentTime and emits server changes. Done means the new currentTime is sent to the server without an unnecessary local React state update, while the existing synchronization behavior remains intact.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Refactor
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.