Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile: Fixes #9328: Fix new note/to-do buttons not visible on app startup in some cases #9329

Conversation

personalizedrefrigerator
Copy link
Collaborator

@personalizedrefrigerator personalizedrefrigerator commented Nov 16, 2023

Summary

Fixes new note/to-do buttons not shown on app startup if "all notes" was the last selected note grouping.

Fixes #9328.

Notes

This pull request adds

diff --git a/packages/app-mobile/root.tsx b/packages/app-mobile/root.tsx
index 5eb8944a2..39cf3d5df 100644
--- a/packages/app-mobile/root.tsx
+++ b/packages/app-mobile/root.tsx
@@ -317,6 +317,7 @@ const appReducer = (state = appDefaultState, action: any) => {
 
 				if ('smartFilterId' in action) {
 					newState.smartFilterId = action.smartFilterId;
+					newState.selectedSmartFilterId = action.smartFilterId;
 					newState.notesParentType = 'SmartFilter';
 				}

I don't think state.smartFilterId is being used anywhere (I think it's always state.selectedSmartFilterId). However, to prevent possible regressions, newState.smartFilterId = ... is not removed.

Testing

  1. Click on "All notes" in the notebook sidebar
  2. Restart the app
  3. Click on the "new note" button and create a new note
  4. Press the back button
  5. Delete all notebooks
  6. Click on "all notes"
  7. Verify that the "new note" button isn't shown

This has been successfully tested on Android 7.

Comment on lines 319 to +320
newState.smartFilterId = action.smartFilterId;
newState.selectedSmartFilterId = action.smartFilterId;
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
newState.smartFilterId = action.smartFilterId;
newState.selectedSmartFilterId = action.smartFilterId;
newState.selectedSmartFilterId = action.smartFilterId;

A follow-up pull request (not targeting the 2.13 branch) should remove newState.smartFilterId = ....

const thisComp = this;

const makeActionButtonComp = () => {
const getTargetFolderId = async () => {
if (!buttonFolderId && isAllNotes) {
return (await Folder.defaultFolder()).id;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can use the activeFolderId setting here, which would be the last selected folder

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The source of the missing note button issue seems to be that activeFolderId is either '' or null on startup when opening the "all notes" screen. The note screen previously only showed the floating action button if activeFolderId or selectedFolderId were not falsey.

@laurent22 laurent22 merged commit dbb354a into laurent22:release-2.13 Nov 19, 2023
10 checks passed
laurent22 pushed a commit that referenced this pull request Nov 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Mobile: New note button no longer visible in "all notes" on startup
2 participants