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: abort scheduled processes on destruction #71

Closed
wants to merge 2 commits into from

Conversation

hoebbelsB
Copy link

fixes #70

DAlperin added a commit to DAlperin/y-prosemirror that referenced this pull request Dec 9, 2021
DAlperin added a commit to DAlperin/y-prosemirror that referenced this pull request Dec 9, 2021
@ValentaTomas
Copy link

ValentaTomas commented Dec 14, 2021

This fix (cursor-plugin.js part specifically) solved my problem with #70 too - it is an almost constant problem when you allow user to switch between several ProseMirror editors.

Are there some other problems with this PR request that prevents it from being merged?

@ValentaTomas
Copy link

ValentaTomas commented Dec 17, 2021

Shouldn't we also clear setTimeout from

setTimeout(() => {
?

Also how about using timeout from lib0/eventloop-- the timeout is already used in this package when updating cursor.

I would gladly make the changes, but I don't want to create a new PR that is essentially the same as this one.

@dmonad Can you please check this issue? I'm using these fixed in our project, but I would be really glad if I could use the y-prosemirror official package again.

DAlperin added a commit to DAlperin/y-prosemirror that referenced this pull request Jan 1, 2022
parent 984175f
author Dov Alperin <dzalperin@gmail.com> 1635443219 -0400
committer Dov Alperin <dzalperin@gmail.com> 1640994693 -0500

Make y-prosemirror behave with subdocuments

+ throw some safety checks in to avoid common (in my testing) footguns

Check for object nullness in equalAttrs

As typeof null is object, equalAttrs falsely expects it to produce
Object.keys thus crashing when comparing object against a null value.

update lib0

1.0.11 (upstream)

Linking to documentation for Awareness protocol.

Some refactors

Bump with bugfix

Bump again

Adopt yjs#71 h/t @hoebbelsB

Revert "Adopt yjs#71 h/t @hoebbelsB"

This reverts commit 0039353.

Use our own protocols

Who needs safety checks anyway?

Revert some debugging changes in search of a known good state

Experimental fix for the cursor jumping bug

More hacks for subdocument bs

revert

parent 984175f
author Dov Alperin <dzalperin@gmail.com> 1635443219 -0400
committer Dov Alperin <dzalperin@gmail.com> 1640994693 -0500

Make y-prosemirror behave with subdocuments

+ throw some safety checks in to avoid common (in my testing) footguns

Check for object nullness in equalAttrs

As typeof null is object, equalAttrs falsely expects it to produce
Object.keys thus crashing when comparing object against a null value.

update lib0

1.0.11 (upstream)

Linking to documentation for Awareness protocol.

Some refactors

Bump with bugfix

Bump again

Adopt yjs#71 h/t @hoebbelsB

Revert "Adopt yjs#71 h/t @hoebbelsB"

This reverts commit 0039353.

Use our own protocols

Who needs safety checks anyway?

Revert some debugging changes in search of a known good state

Experimental fix for the cursor jumping bug

More hacks for subdocument bs

revert

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

remove yarn.lock

1.0.14

Bump

Respect stateField key everywhere actually

Fix some places that ignored the statekey
DAlperin added a commit to DAlperin/y-prosemirror that referenced this pull request Jan 1, 2022
parent 984175f
author Dov Alperin <dzalperin@gmail.com> 1635443219 -0400
committer Dov Alperin <dzalperin@gmail.com> 1640994693 -0500

Make y-prosemirror behave with subdocuments

+ throw some safety checks in to avoid common (in my testing) footguns

Check for object nullness in equalAttrs

As typeof null is object, equalAttrs falsely expects it to produce
Object.keys thus crashing when comparing object against a null value.

update lib0

1.0.11 (upstream)

Linking to documentation for Awareness protocol.

Some refactors

Bump with bugfix

Bump again

Adopt yjs#71 h/t @hoebbelsB

Revert "Adopt yjs#71 h/t @hoebbelsB"

This reverts commit 0039353.

Use our own protocols

Who needs safety checks anyway?

Revert some debugging changes in search of a known good state

Experimental fix for the cursor jumping bug

More hacks for subdocument bs

revert

parent 984175f
author Dov Alperin <dzalperin@gmail.com> 1635443219 -0400
committer Dov Alperin <dzalperin@gmail.com> 1640994693 -0500

Make y-prosemirror behave with subdocuments

+ throw some safety checks in to avoid common (in my testing) footguns

Check for object nullness in equalAttrs

As typeof null is object, equalAttrs falsely expects it to produce
Object.keys thus crashing when comparing object against a null value.

update lib0

1.0.11 (upstream)

Linking to documentation for Awareness protocol.

Some refactors

Bump with bugfix

Bump again

Adopt yjs#71 h/t @hoebbelsB

Revert "Adopt yjs#71 h/t @hoebbelsB"

This reverts commit 0039353.

Use our own protocols

Who needs safety checks anyway?

Revert some debugging changes in search of a known good state

Experimental fix for the cursor jumping bug

More hacks for subdocument bs

revert

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

can pass undoManager to undo-plugin

remove yarn.lock

1.0.14

Bump

Respect stateField key everywhere actually

Fix some places that ignored the statekey
@tommoor
Copy link
Contributor

tommoor commented Feb 28, 2022

This seems like a clean bugfix~ not sure why it's sat for months.

@dmonad dmonad closed this in 6a1433a Mar 29, 2022
@dmonad
Copy link
Member

dmonad commented Mar 29, 2022

Thank you for the PR @hoebbelsB and sorry that it took so long.

I went for a different approach that checks whether the binding is destroyed. I prefer not to clear timeouts because that leads to further issues in the future. setMeta, for example is used in third-party packages as well that don't know that they should clear the timeout.

@ValentaTomas I implemented your suggestion as well and switched from setTimeout to eventloop.timeout. Thanks for the suggestion

@ValentaTomas
Copy link

Thank you for your work!

geekuillaume pushed a commit to geekuillaume/y-prosemirror that referenced this pull request Apr 14, 2022
ronnyroeller pushed a commit to Collaborne/y-prosemirror that referenced this pull request May 11, 2022
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.

Uncaught TypeError: Cannot read properties of null (reading 'matchesNode')
4 participants