Skip to content

Initialize room store only once#3

Open
Adarsh-9182 wants to merge 1 commit into
tinyplex:mainfrom
Adarsh-9182:fix-room-store-initial-json
Open

Initialize room store only once#3
Adarsh-9182 wants to merge 1 commit into
tinyplex:mainfrom
Adarsh-9182:fix-room-store-initial-json

Conversation

@Adarsh-9182

Copy link
Copy Markdown

Summary

  • Move room store JSON initialization into the useCreateStore initializer.
  • Avoid calling setJson(initialJson) during render, which can reset the room store on re-renders.

Why

Calling setJson(initialJson) during render can overwrite synchronized room state whenever RoomStore re-renders. In collaborative rooms, that can make shapes appear to jump back to stale positions while remote updates are also being applied.

This should help with the flickering/jank described in #2.

Verification

  • npm run ts currently fails on upstream-existing errors in src/client/common.ts and src/server/common.ts; this change did not add errors in RoomStore.tsx.
  • npm run lint currently fails because eslint-plugin-jsdoc is referenced by the ESLint config but is not installed as a dependency.

Refs #2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants