Skip to content

Empty objects are not returned #453

Closed
@raymonddaikon

Description

@raymonddaikon

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions