Skip to content
This repository was archived by the owner on Feb 6, 2023. It is now read-only.

Commit ffd8f59

Browse files
scrollbarsfacebook-github-bot
authored andcommitted
Correct warning condition (#2049)
Summary: **Summary** To my knowledge, ```warning``` works the way ```invariant``` does; it warns if the first argument is false not true. Prior to this PR, ```moveSelectionBackward``` warns when the selection is collapsed when it should do the opposite. Pull Request resolved: #2049 Differential Revision: D14699712 fbshipit-source-id: bd649fa6fdc60346d80be27ab4217324c3ef21d6
1 parent aede823 commit ffd8f59

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/component/handlers/edit/commands/moveSelectionBackward.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function moveSelectionBackward(
3131
const selection = editorState.getSelection();
3232
// Should eventually make this an invariant
3333
warning(
34-
!selection.isCollapsed(),
34+
selection.isCollapsed(),
3535
'moveSelectionBackward should only be called with a collapsed SelectionState',
3636
);
3737
const content = editorState.getCurrentContent();

src/component/handlers/edit/commands/moveSelectionForward.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function moveSelectionForward(
3131
const selection = editorState.getSelection();
3232
// Should eventually make this an invariant
3333
warning(
34-
!selection.isCollapsed(),
34+
selection.isCollapsed(),
3535
'moveSelectionForward should only be called with a collapsed SelectionState',
3636
);
3737
const key = selection.getStartKey();

0 commit comments

Comments
 (0)