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

Improve and standarize Navigation API #18703

Open
ulisesmac opened this issue Feb 2, 2024 · 2 comments
Open

Improve and standarize Navigation API #18703

ulisesmac opened this issue Feb 2, 2024 · 2 comments

Comments

@ulisesmac
Copy link
Contributor

Problem

Taken from @briansztamfater 's comment:

Description

[...] it is confusing to have navigation effects and events with same naming, like

{:events [:navigate-back]}
and
(rf/reg-fx :navigate-back

.......
or
.......

{:events [:navigate-to-within-stack]}
and
(rf/reg-fx :navigate-to-within-stack navigate-to-within-stack)

We should rename events to have navigation / namespace prefix as per our guidelines

### Subscription names and event names
Always register events and subscriptions using a meaningful namespace, but don't
namespace them with `::`. We understand it's a controversial decision because
there are both pros and cons to such practice.
Whenever appropriate, it's also recommended to use _fake_ namespaces to convey
more knowledge in the keyword about which bounded context (domain) it refers to.
You may also use dots to convey hierarchical structures.

so events are like :navigation/navigate-back, :navigation/navigate-back-to, :navigation/navigate-to, :navigation/navigate-to-within-stack, etc, or even better they could be improved as :navigation/pop, :navigation/pop-to, :navigation/push, :navigation/push-within-stack, etc, to comply with common nomenclature for stack navigations

@ulisesmac
Copy link
Contributor Author

@briansztamfater I'm adding this as an issue so that it's addressed 👍

@ilmotta
Copy link
Contributor

ilmotta commented Feb 6, 2024

@ulisesmac @brianfernalld FYI: I left navigation effects on purpose out of this PR #18047 to reduce the chance of regressions from a single PR.

We have a new guideline, which I believe has not being solidified in develop yet, where re-frame effects should start with the qualification :effects. This by itself should help differentiate events from effects that have similar or even identical names. You can search in the repo to find many examples.

From this guideline, we would use the keyword :effects.navigation/navigate-within-stack, but that's a mouthful 🤷🏼 We sometimes use very long names in this repo! We could use a little bit of conciseness in widely used names. For instance, nav is a pretty decent abbreviation for navigation.

But anyway, just wanted to share about the PR and the guideline for effect names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Backlog
Development

No branches or pull requests

2 participants