We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
applyPatches throws error Cannot apply patch, path doesn't resolve: map/1/b when applying inversePatches generated by the following produce call:
applyPatches
Cannot apply patch, path doesn't resolve: map/1/b
inversePatches
produce
interface Test { a: number; b: string; } let state = { map: new Map<number, Test>([]) }; state.map.set(1, { a: 5, b: "hello" }); // Setting initial state let inversePatches: Patch[] = []; state = produce( state, (draftState) => { const test = draftState.map.get(1); if (test) test.b = "world"; }, (_patches, _inversePatches) => { inversePatches = _inversePatches; } );
It works fine when the patch op is add instead of replace:
add
replace
state = produce( state, (draftState) => { const test = draftState.map.get(1); if (test) draftState.map.set(1, {...test, b: "world"}); // works }, (_patches, _inversePatches) => { inversePatches = _inversePatches; } );
https://codesandbox.io/s/awesome-stitch-xxtxq3?file=/src/index.ts
Set Map Property
Undo
Steps to reproduce the behavior:
enableMapSet
enablePatches
Map
Map.get()
applyPatches(map, inversePatches)
applyPatches throws error Cannot apply patch, path doesn't resolve: map/1/b.
The inversePatches should be applied successfully and state should revert back to the state it was in before the produce call
state
setUseProxies(true)
setUseProxies(false)
The text was updated successfully, but these errors were encountered:
Getting the same error. Any updates on this?
Sorry, something went wrong.
fix(security): Follow up on CVE-2020-28477 where `path: [["__proto__"…
fa671e5
…], "x"]` could still pollute the prototype
🎉 This issue has been resolved in version 9.0.20 🎉
The release is available on:
Your semantic-release bot 📦🚀
Successfully merging a pull request may close this issue.
🐛 Bug Report
applyPatches
throws errorCannot apply patch, path doesn't resolve: map/1/b
when applyinginversePatches
generated by the followingproduce
call:It works fine when the patch op is
add
instead ofreplace
:Link to repro
https://codesandbox.io/s/awesome-stitch-xxtxq3?file=/src/index.ts
Set Map Property
button to set map propertyUndo
button to callapplyPatches
with inversePatchesTo Reproduce
Steps to reproduce the behavior:
enableMapSet
andenablePatches
Map
with an object as the value type and add some key-value pairs to itproduce
to mutate the Mapproduce
, retrieve an element usingMap.get()
and modify a property on the elementinversePatches
generated byproduce
applyPatches(map, inversePatches)
Observed behavior
applyPatches
throws errorCannot apply patch, path doesn't resolve: map/1/b
.Expected behavior
The
inversePatches
should be applied successfully andstate
should revert back to the state it was in before theproduce
callEnvironment
setUseProxies(true)
setUseProxies(false)
(ES5 only)The text was updated successfully, but these errors were encountered: