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

Avoid broadcasting what was just received #1116

Merged
merged 1 commit into from
Mar 29, 2020

Conversation

vjeux
Copy link
Contributor

@vjeux vjeux commented Mar 29, 2020

Fixes #1115

The issue is that replaceAllElements calls a render synchronously, preventing lastBroadcastedOrReceivedSceneVersion from being set correctly.

I tried using batchUpdate but it only takes a single argument ( https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactFiberWorkLoop.js#L1088 ) whereas the callback takes two.

Test Plan:

  • Add a console.log before this.broadcastScene("SCENE_UPDATE"); in App.tsx
  • Connect a bunch of clients
  • Have one move a shape
  • Make sure that this client has the console logged
  • Make sure the other clients don't have it

Fixes excalidraw#1115

The issue is that replaceAllElements calls a render synchronously, preventing lastBroadcastedOrReceivedSceneVersion from being set correctly.

I tried using batchUpdate but it only takes a single argument ( https://github.com/facebook/react/blob/c5d2fc7127654e43de59fff865b74765a103c4a5/packages/react-reconciler/src/ReactFiberWorkLoop.js#L1088 ) whereas the callback takes two.

Test Plan:
- Add a console.log before `this.broadcastScene("SCENE_UPDATE");` in App.tsx
- Connect a bunch of clients
- Have one move a shape
- Make sure that this client has the console logged
- Make sure the other clients don't have it
@vercel
Copy link

vercel bot commented Mar 29, 2020

This pull request is being automatically deployed with ZEIT Now (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://zeit.co/excalidraw-team/excalidraw/fkv4bg54d
✅ Preview: https://excalidraw-git-fork-vjeux-avoidspamming.excalidraw-team.now.sh

@vjeux
Copy link
Contributor Author

vjeux commented Mar 29, 2020

This should hopefully make the experience with a bunch of people work more smoothly and help with the load on the backend.

@vjeux vjeux merged commit a7bd21c into excalidraw:master Mar 29, 2020
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.

Update spam
1 participant