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

Add: ParcelBoundary.mergeMode #110

Closed
dxinteractive opened this issue Oct 8, 2018 · 4 comments
Closed

Add: ParcelBoundary.mergeMode #110

dxinteractive opened this issue Oct 8, 2018 · 4 comments

Comments

@dxinteractive
Copy link
Collaborator

Merge mode should be able to be set.

  • replace can clear the change buffer contents when a new parcel is received. Safe, but potentially user unfriendly as unsaved changes will be turfed.
  • rebase can retain the change buffer contents when a new parcel is received, and the buffer is applied on top of the new data. It can provide seamless merging of changes, but requires all parts of the parcel to be keyed correctly. Incorrect array re-keying is the biggest barrier and it might not be practical with arrays that delete or re-order, until enty schemas can allow data received from props to be identified correctly by ParcelHoc.
  • merge can retain parts of the change buffer contents when a new parcel is received, but only keep buffered changes that apply to pieces of data that did not change. Changes are typically done on leaves so we're probably safe to use fast-deep-equal to ensure complex objects as leaf nodes are accurately assessed for changes, without suffering the performance penalty that a deep comparison by value can bring.
    • Have not yet thought through how this is affected by incorrect array re-keying.
@dxinteractive
Copy link
Collaborator Author

No need to do this until #123 is done.

The merge mode any not be necessary.

@dxinteractive dxinteractive changed the title Add ParcelBoundary.mergeMode Add: ParcelBoundary.mergeMode Dec 5, 2018
@dxinteractive
Copy link
Collaborator Author

Make this set automatically to use rebase if rekey was used, or else use replace.

@dxinteractive
Copy link
Collaborator Author

Merge mode may also be set to force, which works like replace but ParcelBoundaries will always take in the new data. This could be set in a config option on a ParcelHoc, ParcelBoundary, or ParcelBoundaryHoc.

@dxinteractive
Copy link
Collaborator Author

Also need to provide a way for modifyUps to set this, which would be like a special key on the returned parcelData that can set the requested mergeMode on a ChangeRequest, which can then be read by a ParcelHoc or ParcelBoundaryHoc to override the mergeMode for the resulting update

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

1 participant