question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ContentNavigation doesn't seem to use the :query ?

See original GitHub issue

Environment

Nuxi 3.0.0-rc.11 01:01:15 RootDir: /Users/mathieu/nsinuxt 01:01:15 Nuxt project info: (copied to clipboard) 01:01:15


  • Operating System: Darwin
  • Node Version: v18.9.0
  • Nuxt Version: 3.0.0-rc.11
  • Nitro Version: 0.5.4
  • Package Manager: npm@8.19.2
  • Builder: vite
  • User Config: -
  • Runtime Modules: -
  • Build Modules: -

Reproduction

in pages/[…slug].vue :

<template>
  <div>
    <ContentNavigation v-slot="{ navigation }" :query="querpath">
      <NuxtLayout :navigation="navigation">
        <div class="basis-1/2 shrink grow"><ContentDoc /></div>
      </NuxtLayout>
    </ContentNavigation>
  </div>
</template>

<script setup>
const querpath = queryContent('snt');
</script>

Describe the bug

I want to generate a nav sidebar where I only load the files which are in the same folder as the current page. For this example, I hardcoded “snt” but first I used useRoute() to get the path, then split & concat to get only the first element of the path (in the content folder, there’s two folders : snt and nsi) So I get this ContentNavigation from the catch-all route, then I pass it to the layout, and the layout passes it to the nav sidebar component.

It looks like the ContentNavigation component returns in the navigation variable the tree from the root of the content folder, without taking my “snt” query param.

Maybe my call to ContentNavigation from the catch-all route is not a good practice ?

Additional context

Screenshot 2022-09-27 at 01 06 25

^ From the “localhost:3000/snt” URL ^

I tried the same code directly in the nav sidebar component, and I get the same result : navigation from the root of the content folder.

Logs

No response

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
farnabazcommented, Sep 28, 2022

I see, this happens because the argument of queryContent affects only when you use find/findeOne.

To use query builder for navigation you can manually use where

queryContent().where({ _path: /^\/snt/ })
1reaction
mathieunicolascommented, Sep 28, 2022

Okay, here, the bug is reproduced. Well I don’t know if it’s a bug or not, but the navigation doesn’t take the :query and gives me the items from the root of the contents folder.

https://stackblitz.com/edit/github-vdnwzv-1qzrty?file=components%2Fsidebar.vue,pages%2F[...slug].vue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Navigation form is causing my query to not work - Stack Overflow
forms but I can't seem to wrap my head around how to retrieve my information that I am seeking. I got the 2...
Read more >
Use the Navigation Pane - Microsoft Support
The navigation pane in Access displays database objects and is the primary means by which you view and access all your database objects....
Read more >
How to handle navigation in your app with React Router Link
In this article, we'll explore the navigation possibilities in a React app and we'll take a look at the React Router Link component....
Read more >
Router tutorial: tour of heroes - Angular
Angular application navigation updates the browser history as normal web ... That doesn't match any of the hard-coded routes which means the router...
Read more >
Troubleshoot—ArcGIS Online Help | Documentation
My basemap is unavailable, so none of my map content appears. ... My gamepad or SpaceMouse device doesn't navigate in Scene Viewer. Point...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found