Collab demo - Uncaught RangeError at Function.ResolvedPos.resolve

This happened by keeping on switching between two collab demos doing typing/deleting/undo/redo/cursor movements, I can reproduce this reasonably easy but unfortunately I could not find a sequence of steps to follow.

the debugger stops in: bundle_collab.js line 9288 function StepResult.fromReplace

Uncaught RangeError: Position 140 out of range
    at Function.ResolvedPos.resolve (bundle_collab.js:5641)
    at Function.ResolvedPos.resolveCached (bundle_collab.js:5664)
    at Node.resolve (bundle_collab.js:5040)
    at Node.replace (bundle_collab.js:4995)
    at Function.fromReplace (bundle_collab.js:9285)
    at ReplaceStep.apply (bundle_collab.js:9042)
    at Transaction.maybeStep (bundle_collab.js:9631)
    at bundle_collab.js:1881
    at Leaf.forEachInvertedInner (bundle_collab.js:13774)
    at Append.forEachInvertedInner (bundle_collab.js:13837)

ResolvedPos.resolve @ bundle_collab.js:5641
ResolvedPos.resolveCached @ bundle_collab.js:5664
Node.resolve @ bundle_collab.js:5040
Node.replace @ bundle_collab.js:4995
fromReplace @ bundle_collab.js:9285
apply @ bundle_collab.js:9042
maybeStep @ bundle_collab.js:9631
(anonymous) @ bundle_collab.js:1881
forEachInvertedInner @ bundle_collab.js:13774
forEachInvertedInner @ bundle_collab.js:13837
forEach @ bundle_collab.js:13715
popEvent @ bundle_collab.js:1866
histTransaction @ bundle_collab.js:2123
undo @ bundle_collab.js:2200
handleKeyDown @ bundle_collab.js:2544
(anonymous) @ bundle_collab.js:11862
EditorView.someProp @ bundle_collab.js:11515
editHandlers.keydown @ bundle_collab.js:11862
(anonymous) @ bundle_collab.js:11808

JSON.stringify({doc, from, to, slice}) gives:
"{"doc":{"type":"doc","content":[{"type":"paragraph","content":[{"type":"text","text":"kjhjkhkjhjkhkjjhwedsfdgdsxvd ds f dssasadsfsqqqqdsfsdfsdf jkhjkhjkhjkhjhjkhjkhjkhkjwwwhg hj ghg hj gjhg hjhjg hjg hjgwwweesssdsgdssdfsjkh"}]}]},"from":140,"to":141,"slice":null}"

I hope this patch takes care of this, but let me know if you can still reproduce it. (I’ll do a release later today.)

Thx marijn,

Has the collab demo been updated with the patch ? it’s hard to test otherwise.

I wanted to suggest, considering how complicated and hard to reason about is collab and it’s interaction with history in the case of many concurrent users, a stress test will be really useful.


Yes, the demos get updated on releases.

excuse me? did u solve this bug?i still work with this problem

Probably a different bug. Try to isolate it and submit an issue.