Fix: Update data of roots with modified content only. Closes #534.
Additional information
See #534 for more details. TL;DR:
This happens because setData returned from useMultiRootEditor hook, expects all roots to be passed (since it diffs root list enabling to add/remove them) and existing roots are just updated with passed data, even if it's the same. Such update results in each root model data to be wiped out and re-added which is interpreted by revision history as complete data replace (since it works on model operations and does not diff data changes).
This PR slightly modifies the logic to update only the roots which has changed data.
I dug a bit in the context of below comment in the code:
// If any of the roots content has changed, set the editor data.
// Unfortunately, we cannot set the editor data just for one root,
// so we need to overwrite all roots (nextProps.data is an
// object with data for each root).
But didn't find any case or code which would suggest that we can't do it. All tests green, manuals works fine AFAIT too.
Suggested merge commit message (convention)
Fix: Update data of roots with modified content only. Closes #534.
Additional information
See #534 for more details. TL;DR:
This PR slightly modifies the logic to update only the roots which has changed data.
I dug a bit in the context of below comment in the code:
But didn't find any case or code which would suggest that we can't do it. All tests green, manuals works fine AFAIT too.