When a Loro map value is an empty object, calling .toJSON() on the Loro map will omit the value. This is specifically a problem in loro-prosemirror where the attributes key is often an empty object. This is specifically a problem in nested containers as top level values will return an empty object, but for nested values inside Loro Lists etc. the value is completely omitted even though the data is being detected in the batch event diff. For example setting text as bold in prosemirror will trigger a change event on the map that will return diff: [{ attributes: bold: {}, retain: 1 }] but calling .toJSON() on that map will return attributes: {}. Update: Was reading the logs wrong, as it was changing the attributes value on the LoroText instead of the Map.
When a Loro map value is an empty object, calling
.toJSON()
on the Loro map will omit the value. This is specifically a problem in loro-prosemirror where the attributes key is often an empty object. This is specifically a problem in nested containers as top level values will return an empty object, but for nested values inside Loro Lists etc. the value is completely omitted even though the data is being detected in the batch event diff. For example setting text as bold in prosemirror will trigger a change event on the map that will returndiff: [{ attributes: bold: {}, retain: 1 }]
but calling.toJSON()
on that map will returnattributes: {}
. Update: Was reading the logs wrong, as it was changing the attributes value on the LoroText instead of the Map.