Combination of proxyWithHistory and subscribe #506
-
Hello, first of all thanks for all the great work done her with valtio! I am currently changing part of the code of an existing application from using I recreated the problem with codesandbox.io: https://codesandbox.io/s/valtio-subscribe-proxywithhistory-eir1bo
As this is a post in the Q&A now my question: are my expectations wrong and as soon as Thanks a lot in advance |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
Beta Was this translation helpful? Give feedback.
undo()
will replacekeyValueProxy.value
with a new object, so you have to subscribe tokeyValueProxy
to get notified with undo.https://codesandbox.io/s/valtio-subscribe-proxywithhistory-forked-uk394m
(If you need to track some specific properties, you would need to keep the previous value and compare.)