jsondiffpatch icon indicating copy to clipboard operation
jsondiffpatch copied to clipboard

nested objects key on patch({}, diff)

Open leblancmeneses opened this issue 6 years ago • 2 comments

The following error occurs

TypeError: Cannot read property 'cd2ee684b4e02497112b0da7e2cf8abf82e468025710054e39adf0ad2bbefa43' of undefined
    at nestedPatchFilter (nested.js:73)
    at Pipe.webpackJsonp.../../../../jsondiffpatch/src/pipe.js.Pipe.process (pipe.js:18)
    at Processor.webpackJsonp.../../../../jsondiffpatch/src/processor.js.Processor.process (processor.js:46)
    at DiffPatcher.webpackJsonp.../../../../jsondiffpatch/src/diffpatcher.js.DiffPatcher.patch (diffpatcher.js:52)
    at CloseEventListComponent.<anonymous> (close-event-list.component.ts:139)
    at step (main.bundle.js:933)
    at Object.next (main.bundle.js:914)
    at main.bundle.js:908
    at new ZoneAwarePromise (zone.js:847)

diffpatcher

When patching a diff that looks like this:

      const patch = patcher.patch({}, {"hitters":{"cd2ee684b4e02497112b0da7e2cf8abf82e468025710054e39adf0ad2bbefa43":{"hitterPercentage":[63,70]}},"paymentStatus":["approved for payment"]});

My goal is to create an object with only the changes.

leblancmeneses avatar Aug 04 '17 02:08 leblancmeneses

Hi @leblancmeneses, any news on this? Did you handle it somehow? I have similar problem.

When I have one object and compare it to another, then delete property and run patch, it can throw an error, because property does not exist.

Example on JSfiddle: https://jsfiddle.net/5f983yxq/2/

psalkowski avatar Apr 09 '20 06:04 psalkowski

Also having this issue

spilliton avatar Apr 07 '22 20:04 spilliton