Update event sometimes not fired

Sometimes the update event wont fire when clicking around. This mostly happens when you click on a new empty line or at end of lines. I can reproduce this in Chrome and Firefix. Is this a known issue/limitation?

Apr-11-2019%2021-18-32

This is my code:

new Plugin({
  view() {
    return {
      update() {
        console.log('update', Date.now())
      },
    }
  },
})

Could you post more of your code? This doesn’t look right based on what I know.

Update will not fire if the prosemirror result from the selection poller doesn’t move, therefor nothing changed on click technically. But, I’ve seen weird stuff where there’s a limitation in the browser itself for where it thinks the cursor is based on browser wrapping, not prosemirror’s fault. I posted something simliar. This is not the same problem though.

Got more code you can show?

Here is a demo. It seems that the bug appears when clicking between two nodes? The selection changes but there is no update event.

bug

1 Like

That’s pretty easy to explain. You can’t see it in your clip, but, you’re clicking the doc position, you can see it as position 83 in your clip. Its depth is 0, you cannot make a textselection across non-inline content normally, So, When prosemirror does its logic and all that stuff, it tries to find a new place for your selection when you click. When it comes to the conclusion theres no difference in where the selection would be, or changes in the dom that it can pass along it won’t hit any update. Update only fires if there was some visual change that you want to handle in some way in the plugin. That doesnt mean that mouse events won’t fire.

Ah, thank you for this explanation. Makes totally sense. But as you can see in my initial gif, I maybe identified the wrong issue. I have to check my code again.

No problem.

Okay it seems like the issue is this one and @marijn already fixed it today. Thanks :wink: