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

Fix: Lock interactivity & sync width resize & improve render performance #120

Merged
merged 6 commits into from
Dec 5, 2022

Conversation

li-xin-yi
Copy link
Collaborator

  1. Fix several node initialization issues: specify custom drag handle, check init state after the provider synced, specify width when adding pod to the db, etc.
  2. Enforce write access control for guests: hide the interactivity button (lock) globally, disable the resize box, and discard any node info update to the yjs servers from a guest. In this early stage, a user may feel a little inconvenient to select text in a pod without the button, however, they can fix the viewpoint by pressing Control temporarily. We (@lihebi ) will implement some other robust method to add auth layer to the yjs servers and fix the viewpoint automatically in the future if we have time.

image

  1. Sync code pod resize in real-time: rewrite the logic of resetting the pod width, which makes all users observe the dimension update immediately when a user conduct resizing operation on it.
  2. Improve the render speed when a codeNode is re-rendered: manage the isEditorBlur state globally instead of locally, otherwise, MyMonaco will be re-render over and over again any time the codeNode changes. If we click on the editor and then click other places, you can see it causes the re-rendering of MyMonaco twice, which takes much time:

Before

But after we apply this PR, any update propagation stops at the MyMonaco .

After It reduces the re-render overhead a lot, especially when you drag a codeNode.

@lihebi
Copy link
Collaborator

lihebi commented Dec 5, 2022

Added a few commits:

  • There was a (seemingly unnecessary) dimension change at the very beginning of canvas page, which causes dirty status of all CodeNodes to be set. Added a check to prevent that.
  • Directly set pod.dirty status without checking hash.
  • Enable redux devtools for easier debugging.

Copy link
Collaborator

@lihebi lihebi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, Xinyi!

@lihebi lihebi merged commit 48a9d01 into codepod-io:main Dec 5, 2022
@li-xin-yi li-xin-yi deleted the fix/collab_resize branch December 8, 2022 01:47
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