Skip to content

Commit

Permalink
Fix adding note from trash so it takes you back to All Notes (#2746)
Browse files Browse the repository at this point in the history
Fixes #2743 which was a regression.

This enables the new note button when in the trash and ensures you are switched to the All Notes view when creating a new note from the trash.
  • Loading branch information
sandymcfadden authored Mar 18, 2021
1 parent a622fc0 commit 788d8c2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 0 additions & 1 deletion lib/menu-bar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export const MenuBar: FunctionComponent<Props> = ({
/>
<div className="notes-title">{placeholder}</div>
<IconButton
disabled={collection.type === 'trash'}
icon={<NewNoteIcon />}
onClick={() => onNewNote(withoutTags(searchQuery))}
title={`New Note • ${CmdOrCtrl}+Shift+I`}
Expand Down
6 changes: 6 additions & 0 deletions lib/state/ui/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ const collection: A.Reducer<T.Collection> = (
action
) => {
switch (action.type) {
case 'CREATE_NOTE_WITH_ID': {
if (state.type === 'trash') {
return { type: 'all' };
}
return state;
}
case 'OPEN_TAG':
return { type: 'tag', tagName: action.tagName };
case 'SELECT_TRASH':
Expand Down

0 comments on commit 788d8c2

Please sign in to comment.