Maximum call stack exceeded when initializing Automerge.Text with large (500kb) string

Author: cgauldCreated Jun 30, 2022Updated Aug 19, 2022

Hi!

We're using Preview 6 and have found that initializing Automerge.Text, like this:

doc.text = new Automerge.Text(largeString);

Causes the following error stack when called with a ~500kb string.

Uncaught (in promise) RangeError: Maximum call stack size exceeded
    at updateTextObject (...)
    at interpretPatch (...)
    at getValue (...)
    at applyProperties (...)
    at updateMapObject (...)
    at Context.interpretPatch [as applyPatch] (...)
    at Context.applyAtPath (...)
    at Context.setMapKey (...)
    at Object.set (...)

I haven't spotted an issue for this so I thought I'd add one. Would be grateful to hear of any thoughts/workarounds.

Thanks all!

Source: automerge/automerge-classic