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

Namespaced awareness #1

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
Draft

Namespaced awareness #1

wants to merge 7 commits into from

Conversation

jasonm
Copy link
Owner

@jasonm jasonm commented Nov 21, 2021

WIP. The commits aren't yet cleaned up for easy review/understanding.

The diff in useCursor.ts is a little hard to read because there are two changes:

  1. I made some changes so that newCursorData only looks at other awarenesses where their awarenessPath value matches the awarenessPath of this editor.
  2. I took the editor.awareness.on('update', () => { ... }) code from the useEffect and extracted that into its own onUpdate so that the useEffect can unregister the handler on cleanup.

I also call that onUpdate handler one extra time in the useEffect setup. I thought that this solved a case when we render a fresh editor for a type that already has other users' present cursors in the awareness. But I don't think it's working like I want it to, so it may be unnecessary.

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.

1 participant