-
Notifications
You must be signed in to change notification settings - Fork 522
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
DDS to use deep-cloning / immutable objects when raising events, returning current state #5738
Comments
This PR has been automatically marked as stale because it has had no activity for 60 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework! |
This issue has been automatically marked as stale because it has had no activity for 180 days. It will be closed if no further activity occurs within 8 days of this comment. Thank you for your contributions to Fluid Framework! |
Let's consider a case of ISharedMap (as an example) and a value stored in it being an object (any mutable object, like an array, or object with properties).
There are 3 key workflows:
Requirements:
Today, first two scenarios are broken.
While third one sort of works, but really broken as value change event is incorrect (it would say that nothing changed).
There are 3 possible mechanisms we could use here:
So it looks like deep clone is the only possible solution here.
Please note that from implementation perspective, it does not have to be full clone.
Libraries like Immer and immutable.js could be used to optimize process here.
As for API surface, that implies to everything, including change event notifications - we should never ever expose internal data structures for user to be able to directly modify them.
The text was updated successfully, but these errors were encountered: