'Cannot convert undefined or null to object' in equalAttrs
TeemuKoivisto opened this issue · 1 comments
TeemuKoivisto commented
In equalAttrs, yattrs
can be null thus crashing when Object.keys(yattrs)
is executed.
I suppose this happens because iterating over attribute keys a check is done:
eq = key === 'ychange' || l === r || (typeof l === 'object' && typeof r === 'object' && equalAttrs(l, r))
Which in case when comparing a regular object {}
against null
tries to recurse the null because null's typeof is object. A rather unfortunate fact but that's how it is. So maybe a fix could be adding a nullness check in that condition or at the start of the function.
To Reproduce
I'll write a reproduction if needed.
Environment Information
"y-prosemirror": "^1.0.12",
dmonad commented
Sure, you can create a PR for it.