Skip to content
New issue

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

Proxy based patch generation #8

Open
Korijn opened this issue Nov 4, 2021 · 3 comments
Open

Proxy based patch generation #8

Korijn opened this issue Nov 4, 2021 · 3 comments

Comments

@Korijn
Copy link
Collaborator

Korijn commented Nov 4, 2021

As an alternative to diffing, one can also monitor mutations as they are being made against the input and emit patches, by using a proxy mechanism. This is how Immer works. It's much more efficient than diffing, of course.

@berendkleinhaneveld
Copy link
Collaborator

Yeah, I wanted to propose to do something like this within observ actually as we have all the proxy stuff in place.

@Korijn
Copy link
Collaborator Author

Korijn commented Nov 4, 2021

I thought about doing that, but I think it requires very different trap implementations and assignments, so we might as well implement it here in this library and keep observ focused on what it does best.

@Korijn
Copy link
Collaborator Author

Korijn commented Nov 15, 2021

The magic is here: https://github.com/immerjs/immer/blob/master/src/core/proxy.ts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants