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

Setting data of any root with MultiRoot editor results in revision history marking all roots as changed #534

Closed
f1ames opened this issue Sep 24, 2024 · 0 comments · Fixed by #535
Labels
squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:bug
Milestone

Comments

@f1ames
Copy link
Contributor

f1ames commented Sep 24, 2024

Reproduction steps

It can be done in multiple ways, the fastest for me was by using collaboration samples.

  1. Checkout collaboration samples repo and follow setup instructions.
  2. In real-time-collaboration-editor-multi-root-for-react expose data and setData returned by useMultiRootEditor. This can be done by modifying this line as:
	const { data, setData, editableElements, toolbarElement, attributes } = useMultiRootEditor( editorProps );

	window.setData = setData;
	window.data = data;
  1. Run the sample with yarn && yarn dev.
  2. Go to http://localhost:5173/.
  3. Open dev console, paste and execute window.setData({...window.data, header: '123123'}).
  4. Go to editor revision history.

Expected

Only header root is marked as changed.

Actual

All roots are marked as changed:

image

A bit of context

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).

@f1ames f1ames added type:bug squad:collaboration Issue to be handled by the Collaboration team. labels Sep 24, 2024
@aldonace-wu aldonace-wu added the support:2 An issue reported by a commercially licensed client. label Sep 24, 2024
@CKEditorBot CKEditorBot added this to the iteration 79 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:collaboration Issue to be handled by the Collaboration team. support:2 An issue reported by a commercially licensed client. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants