ricos icon indicating copy to clipboard operation
ricos copied to clipboard

[BUG] isContentEqual returns different result depending on param order

Open EdgBuc opened this issue 2 years ago • 1 comments

If the difference between contents is only data property (at least reproduced with this property, haven't tried other) in the blocks. Then the result of the isContentEqual function will depend on the order of parameters.

example:

      const content1 = {
        entityMap: {},
        blocks: [
          {
            key: 'content-key',
            text: 'some-text',
            type: 'unstyled',
            depth: 0,
            inlineStyleRanges: [],
            entityRanges: [],
            data: {},
          },
        ],
        VERSION: '8.42.2',
      };

      const content2 = {
        entityMap: {},
        blocks: [
          {
            key: 'content-key',
            text: 'some-text',
            type: 'unstyled',
            depth: 0,
            inlineStyleRanges: [],
            entityRanges: [],
            data: {
              anything: 'here',
            },
          },
        ],
        VERSION: '8.42.2',
      };

then we will have:

isContentEqual(content1, content2) === true
isContentEqual(content2,content1) === false

Expected bahaviour: in both cases isContentEqual should return false.

lib Version: 8.54.2

EdgBuc avatar Oct 08 '21 06:10 EdgBuc

@EdgBuc thanks for reporting! will be fixed in following releases

lxgreen avatar Oct 19 '21 14:10 lxgreen