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

Allow to nest routes with params propogation #19

Open
Tracked by #31
sergeysova opened this issue Aug 2, 2022 · 2 comments
Open
Tracked by #31

Allow to nest routes with params propogation #19

sergeysova opened this issue Aug 2, 2022 · 2 comments
Assignees
Labels
feature Add new functionality
Milestone

Comments

@sergeysova
Copy link
Member

/org/:orgId/repo/:repoId

const orgRoute = createRoute<{ orgId: string }>();
const repoRoute = orgRoute.createRoute<{ repoRoute: string }>();

1

  1. User on the path /org/100/repo/200
  2. We call repoRoute({ repoId: 123 })
  3. User redirected to /org/100/repo/123

2

  1. User on the path /org/100/repo/200
  2. We call repoRoute({ repoId: 123, orgId: 5 })
  3. User redirected to /org/5/repo/123
@sergeysova sergeysova added the enhancement Improvement of existing functionality label Aug 2, 2022
@sergeysova sergeysova added this to the v1 milestone Aug 15, 2022
@igorkamyshev
Copy link
Contributor

igorkamyshev commented Aug 15, 2022

Methods of objects is a big headache for AST awared tools like babel-plugin or eslint-plugin. I suggest making it like the new API of domains in Effector, something like this:

const orgRoute = createRoute<{ orgId: string }>();
const repoRoute = createRoute<{ repoRoute: string }>({ parent: orgRoute });

@sergeysova sergeysova added feature Add new functionality and removed enhancement Improvement of existing functionality labels Aug 30, 2022
@velialiev
Copy link
Contributor

Should parent's route params be accessible from child route?

const orgRoute = createRoute<{ orgId: string }>();
const repoRoute = createRoute<{ repoRoute: string }>({ parent: orgRoute });

repoRoute.$params // { orgId, repoRoute } or only { repoRoute } ?

@sergeysova sergeysova self-assigned this Nov 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Add new functionality
Projects
None yet
Development

No branches or pull requests

3 participants