You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the sharedHistory is a shared across parent/nested editors, you can reach a state where the HistoryEntry contains an EditorState and a undoSelection that do not point to the editor. This will always cause the editor to crash as it won't be able to find the node to select.
For #4389 in particular it seems like this can ocurr when the you previously had a selection on another editor and you then create the first change onto the new editor. The first change will carry the editor and editorEditor from the previous parent iteration and the selection will be previousSelection of the nestedEditor, regardless of what the selection of the nestedEditor is it will never be the selection of the (parent) editor
What I'm suggesting in this PR is to remove any chances that it can be out-of-sync, by relying on the selection in the same EditorState.
But I'm not sure why undoSelection was created in the first place so I might be missing something important.
See #966 summary recording for a case where undo selection was added. Although it seems to work without undoSelection now, probably addressed with a better calculation of history push vs history merge cases
See #966 summary recording for a case where undo selection was added. Although it seems to work without undoSelection now, probably addressed with a better calculation of history push vs history merge cases
@fantactuka - I can repro the same behavior as the test plan without it
Mind sharing more details on why we need undoSelection please?
Mind sharing more details on why we need undoSelection please?
IIRC it was specifically added for cases when few operations coalesced including caret move, and during undo caret position supposed to be in (N-1). That's all I can remember :) I suppose it has been fixed with history merge algo adjustments for selection-change cases, so as long as it works as in test plan above I'm more than happe to remove undoSelection
Mind sharing more details on why we need undoSelection please?
IIRC it was specifically added for cases when few operations coalesced including caret move, and during undo caret position supposed to be in (N-1). That's all I can remember :) I suppose it has been fixed with history merge algo adjustments for selection-change cases, so as long as it works as in test plan above I'm more than happe to remove undoSelection
That's how it works now which behavior is identical to the previous version. While arguably there's undo nits that don't work like other browsers (line new line) the behavior is the same.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLA SignedThis label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed.
3 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Need a proper review on this one...
When the sharedHistory is a shared across parent/nested editors, you can reach a state where the HistoryEntry contains an EditorState and a
undoSelectionthat do not point to the editor. This will always cause the editor to crash as it won't be able to find the node to select.For #4389 in particular it seems like this can ocurr when the you previously had a selection on another editor and you then create the first change onto the new editor. The first change will carry the
editorandeditorEditorfrom the previous parent iteration and the selection will bepreviousSelectionof thenestedEditor, regardless of what the selection of thenestedEditoris it will never be the selection of the (parent)editorWhat I'm suggesting in this PR is to remove any chances that it can be out-of-sync, by relying on the selection in the same EditorState.
But I'm not sure why
undoSelectionwas created in the first place so I might be missing something important.Fixes #4389