Skip to content
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

Don't update local currentTime state unnecessarily #12

Open
JoshuaKGoldberg opened this issue Sep 1, 2020 · 0 comments
Open

Don't update local currentTime state unnecessarily #12

JoshuaKGoldberg opened this issue Sep 1, 2020 · 0 comments
Labels
area: game runtime Improvements to the core game experience. good first issue You can do this as a way to learn about the code! ❤ status: accepting prs This issue is ready for a pull request. type: cleanup Improving the structural quality of code or runtime smoothness/performance.

Comments

@JoshuaKGoldberg
Copy link
Collaborator

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

useInterval(() => {
emitRoomData({
currentTime: videoElement.currentTime,
});
}, videoElementSyncInterval);

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.

@JoshuaKGoldberg JoshuaKGoldberg added area: game runtime Improvements to the core game experience. status: accepting prs This issue is ready for a pull request. type: cleanup Improving the structural quality of code or runtime smoothness/performance. good first issue You can do this as a way to learn about the code! ❤ labels Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: game runtime Improvements to the core game experience. good first issue You can do this as a way to learn about the code! ❤ status: accepting prs This issue is ready for a pull request. type: cleanup Improving the structural quality of code or runtime smoothness/performance.
Projects
None yet
Development

No branches or pull requests

1 participant