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

Generalize goBack feature for CollectionCreate #117

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zecakeh
Copy link
Contributor

@zecakeh zecakeh commented Jan 21, 2021

Instead of relying on the name of the previous screen to send the newly created colUid back, we use a route param. This will allow to have the same behavior on other screens.

Fixes #156

Tested on web Firefox Linux
Tested on native Android

@tasn
Copy link
Member

tasn commented Feb 5, 2021

This feels more hacky to me. I'd rather avoid complexity as much as possible. What does this PR actually solve that's worth the added complexity?

@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 5, 2021

To me it's a UX improvement. There are two ways you can create a Collection:

  • From the drawer: after you create the collection, you'd expect to be redirected to the newly created collection
  • When you create a new note: after you create the collection, you'd expect to be redirected to the previous screen
  • Later: when you import notes: same behavior as the above

@tasn
Copy link
Member

tasn commented Feb 7, 2021

Maybe I'm misunderstanding, but:

* From the drawer: after you create the collection, you'd expect to be redirected to the newly created collection

OK, so after a create there, just redirect.

* When you create a new note: after you create the collection, you'd expect to be redirected to the previous screen

After a create there, just redirect to the right place.

* Later: when you import notes: same behavior as the above

Same.

Maybe I'm just misunderstanding the patch, but I don't understand why the behaviour needs to be centralised. Just do whatever you need to do in whatever view you are. Or are your examples about changing the history stack because you want the back button to behave a certain way? I still don't understand what you are trying to achieve.

@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 7, 2021

This patch is to avoid to hardcode the screens in CollectionEditScreen, but rather let the screen that initiated the new notebook tell CollectionEditScreen to send back the colUid. That allows us to add views with that behavior without having to touch CollectionEditScreen. I don't see it as more complex, but maybe you do.

If you're fine with hardcoding the screens, this PR should be closed.

@tasn
Copy link
Member

tasn commented Feb 8, 2021

Definitely not fine with hardcoding. I just don't understand what this patch really does it seems. Could you maybe describe the purpose of this patch in plain words again? As I still don't get it.

@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 8, 2021

Okay then maybe you're seeing a solution that I don't. I'll try to explain in detail:

Use case 1, the user creates a Notebook from the drawer:

  1. The user can be on any screen (because the Menu button can be available in any screen on web).
  2. Press Create new notebook in the drawer
  3. The drawer triggers navigation to CollectionEditScreen without params
  4. The user fills the form and presses the Save button
  5. CollectionEditScreen stores the info, and since it didn't receive params, triggers navigation forward or back to NotesListScreen with the new colUid as a param
  6. The user is on the newly created Notebook's screen

Use case 2, the user creates a Note, and realizes it should be in a new Notebook:

  1. The user is in NotePropertiesScreen
  2. Press the + button in the Notebook select
  3. The NotePropertiesScreen triggers navigation to CollectionEditScreen without param goBack: true
  4. The user fills the form and presses the Save button
  5. CollectionEditScreen stores the info, and since it received the param goBack, triggers navigation back to NotePropertiesScreen with the new colUid as a param
  6. The user is back on the New Note screen, with the new notebook selected

@tasn
Copy link
Member

tasn commented Feb 21, 2021

OK, I think this is where the confusion stemmed from. I didn't remember that the menu button is always visible on the web...
Is this change still needed now that we have different tabs? Or are the different tabs just for the home screen?

And sorry for maybe asking the same question twice but why not always go back? Because sometimes it's from a screen that you don't want to go to, and in that case you want to just go to a certain page? Anyhow, I'm fine with this change if this is the case, just make sure to fix the conflicts and let me know.

@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 21, 2021

Previously it's because you could open "Create Notebook" from any page on web (i.e. the Settings if you opened directly notes.etesync.com/settings) so it was more logical to navigate to the Notebook's page. However it's not in the Drawer anymore, so I guess we can always go back… I'll check that and change it accordingly.

@tasn
Copy link
Member

tasn commented Feb 21, 2021

Let's always go back then, I think that's better. :)
I try to avoid complexity as much as possible, and every condition or parameter are complexity.

@zecakeh zecakeh mentioned this pull request Feb 22, 2021
@zecakeh zecakeh force-pushed the collectionedit-goback branch from 58625b3 to 183b309 Compare February 22, 2021 16:35
@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 22, 2021

Changed and ready for review

Edit: I just realized this won't work with split view because you'll be able to create a new notebook on every screen, since the list is always present on the left. So I'd say just use goBack and store the open notebook in state to be able to change it from CollectionCreate

@zecakeh zecakeh force-pushed the collectionedit-goback branch from 183b309 to b92b298 Compare February 23, 2021 17:55
@sturdy-devtools
Copy link

sturdy-devtools bot commented Feb 23, 2021

Potential conflicts warning

This pull request has changes that are conflicting with the changes in 2 open PRs.

#163 Rename RootStackParamList.tsx to NavigationConfig.tsx by @zecakeh (updated 5 minutes ago)

  • src/RootStackParamList.tsx

#164 Move linking config to NavigationConfig by @zecakeh (updated Just now)

  • src/RootStackParamList.tsx

@zecakeh
Copy link
Contributor Author

zecakeh commented Feb 23, 2021

So I made the modifications I suggested. We now lose the feature that selects the newly created Notebook in the New Note form. To do that I do believe I need to reintroduce a route param.

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.

Add redirect when creating a notebook when creating a task
2 participants