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 linking to nested pages with current params set by default #140

Open
tdolsen opened this issue Feb 22, 2024 · 1 comment
Open

Allow linking to nested pages with current params set by default #140

tdolsen opened this issue Feb 22, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@tdolsen
Copy link

tdolsen commented Feb 22, 2024

Describe the bug
When using NuxtLink to link to nested sub pages from a page with params, those params are not identified as defaults, and have to be redefined in :to.

Expected behavior
As with how RouterLink/NuxtLink actually works, I expect the typed overload to identify which params are available for a given page, and make those params optional when using NuxtLink.

Screenshots
pages/okr/ice/index.vue:
image

Environnement infos

  • Operating System: Linux
  • Node Version: v18.19.0
  • Nuxt Version: 3.10.2
  • CLI Version: 3.10.1
  • Nitro Version: 2.8.1
  • Package Manager: [email protected]
  • Builder: -
  • User Config: devtools, modules
  • Runtime Modules: [email protected]
  • Build Modules: -

Your pages folder structure

pages
├── index.vue
└── okr
    └── ice
        └── [id]
            ├── index.vue
            └── respond.vue

Your nuxt.config.ts

export default defineNuxtConfig({
	devtools: { enabled: true },
	modules: ["nuxt-typed-router"],
});
@victorgarciaesgi
Copy link
Owner

Hi!

I explain it here: https://nuxt-typed-router.vercel.app/usage/how-to-use#pagesnestedtitleuseridindexvue

As the type system cannot know where you're navigating from, it's not really possible. You could be navigating from any other non-nested pages and the params should be required.

It's a complicated case

@victorgarciaesgi victorgarciaesgi added the enhancement New feature or request label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants