Skip to content

Commit

Permalink
Fix: Replace missing click handler in revision slider
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dmsnell committed Jan 16, 2020
1 parent ee3c63e commit 5d9ace5
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/revision-selector/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ export class RevisionSelector extends Component<Props, State> {
}
}

handleClickOutside = () => this.onCancelRevision();

onAcceptRevision = () => {
const { note, onUpdateContent, resetIsViewingRevisions } = this.props;
const { revisions, selection } = this.state;
Expand Down

0 comments on commit 5d9ace5

Please sign in to comment.