ipld / js-block

IPLD Block Interface
6 stars 3 forks source link

fix: dag-pb nodes can’t be copied #5

Closed mikeal closed 4 years ago

mikeal commented 4 years ago

Carson found a good bug in the new safe/unsafe release. dag-pb nodes aren’t data model so they don’t return simple types and therefor can’t actually be cloned nicely. this PR special cases dag-pb in order to fix.

rvagg commented 4 years ago

what is this even fixing?

carsonfarmer commented 4 years ago

@rvagg this fixes the following error when decoding a PB-based IPLD node:

UnhandledPromiseRejectionWarning: Error: Can't set property: 'Data' is immutable
    at ClassIsWrapper.set Data [as Data] (.../node_modules/ipld-dag-pb/src/dag-node/index.js:63:11)
    at transform (.../node_modules/@ipld/block/index.js:17:17)