Skip to content

Commit

Permalink
fix: wait for CompletedFullSync before showing "No Notes."
Browse files Browse the repository at this point in the history
  • Loading branch information
arielsvg committed Sep 23, 2020
1 parent f819513 commit 5c98633
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion app/assets/javascripts/views/notes/notes-view.pug
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,11 @@
label="'Date'"
)
p.empty-notes-list.faded(
ng-if="self.state.localDataLoaded && !self.state.renderedNotes.length"
ng-if="self.state.completedFullSync && !self.state.renderedNotes.length"
) No notes.
p.empty-notes-list.faded(
ng-if="!self.state.completedFullSync && !self.state.renderedNotes.length"
) Loading notes…
.scrollable(ng-if="self.state.renderedNotes.length")
#notes-scrollable.infinite-scroll(
can-load='true',
Expand Down
11 changes: 6 additions & 5 deletions app/assets/javascripts/views/notes/notes_view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ type NotesState = {
hideDate?: boolean
noteFilter: { text: string }
mutable: { showMenu: boolean }
localDataLoaded: boolean
completedFullSync: boolean
[WebPrefKey.TagsPanelWidth]?: number
[WebPrefKey.NotesPanelWidth]?: number
[WebPrefKey.EditorWidth]?: number
Expand Down Expand Up @@ -127,7 +127,7 @@ class NotesViewCtrl extends PureViewCtrl<{}, NotesState> {
mutable: { showMenu: false },
noteFilter: { text: '' },
panelTitle: '',
localDataLoaded: false,
completedFullSync: false,
};
}

Expand Down Expand Up @@ -167,17 +167,18 @@ class NotesViewCtrl extends PureViewCtrl<{}, NotesState> {
case ApplicationEvent.SignedIn:
this.appState.closeAllEditors();
this.selectFirstNote();
this.setState({
completedFullSync: false,
});
break;
case ApplicationEvent.CompletedFullSync:
this.getMostValidNotes().then((notes) => {
if (notes.length === 0) {
this.createPlaceholderNote();
}
});
break;
case ApplicationEvent.LocalDataLoaded:
this.setState({
localDataLoaded: true,
completedFullSync: true,
});
break;
}
Expand Down

0 comments on commit 5c98633

Please sign in to comment.