Skip to content

Commit c599b27

Browse files
authored
Fix: Replace missing click handler in revision slider (#1837) (#1850)
In paFIJd-8t it was reported that note corruption was occurring when viewing the history of one note when it gets updated remotely. Although this fix may or may not address that problem a code audit revealed that in #1792 I removed what appeared to be an unused function when it was in fact used by the component's `onClickOutside` wrapper. The missing handler function closed out of the revision slider when clicking anywhere else. Without it, the thread handling the click crashed but since it was a callback it didn't crash the app. A message appeared in the developer console indicating that the handler was missing. Because we haven't been closing the revision slider it has become possible to start editing a note while the revisions are still open, something prevented before by way of the click handler. Thus, if viewing a revision, clicking anywhere else, and continuing, then we fill the editor with what it thinks is a note (and not a revision) and then will respond to remote updates with the contents of that revision before accepting remote updates. (cherry picked from commit 43bc2a5)
1 parent 5711630 commit c599b27

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

RELEASE-NOTES.txt

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
- Fix ol numbering in markdown preview [#1823](https://github.com/Automattic/simplenote-electron/pull/1823)
2020
- Prevents weird effects in live previews due to incomplete input [#1822](https://github.com/Automattic/simplenote-electron/pull/1822)
2121
- Fixed a bug where searching for a tag containing non-alphanumeric characters erroneously returned no notes [#1828](https://github.com/Automattic/simplenote-electron/pull/1828)
22+
- Properly close revision/history view when clicking outside of slider [#1837](https://github.com/Automattic/simplenote-electron/pull/1837)
2223

2324
### Other Changes
2425

lib/revision-selector/index.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ export class RevisionSelector extends Component<Props, State> {
7171
}
7272
}
7373

74+
handleClickOutside = () => this.onCancelRevision();
75+
7476
onAcceptRevision = () => {
7577
const { note, onUpdateContent, resetIsViewingRevisions } = this.props;
7678
const { revisions, selection } = this.state;

0 commit comments

Comments
 (0)