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

findSurround() return array is always [null,null] #1547

Closed
michaelvcolianna opened this issue Sep 21, 2022 · 1 comment · Fixed by #1609
Closed

findSurround() return array is always [null,null] #1547

michaelvcolianna opened this issue Sep 21, 2022 · 1 comment · Fixed by #1609

Comments

@michaelvcolianna
Copy link

michaelvcolianna commented Sep 21, 2022

Environment

Primary

Nuxi 3.0.0-rc.10                                                                        14:29:14
RootDir: /Users/michaelcolianna/Sites/nuxtkiwis                                         14:29:15
Nuxt project info: (copied to clipboard)                                                14:29:15

------------------------------
- Operating System: `Darwin`
- Node Version:     `v16.16.0`
- Nuxt Version:     `3.0.0-rc.10`
- Nitro Version:    `0.5.4`
- Package Manager:  `npm@8.11.0`
- Builder:          `vite`
- User Config:      `-`
- Runtime Modules:  `-`
- Build Modules:    `-`
------------------------------

StackBlitz

Nuxi 3.0.0-rc.11                                                                                                                  14:30:00
RootDir: /home/projects/github-pdzf4a                                                                                             14:30:01
Nuxt project info:                                                                                                                14:30:01

------------------------------
- Operating System: `Linux`
- Node Version:     `v16.14.2`
- Nuxt Version:     `3.0.0-rc.11`
- Nitro Version:    `0.5.4`
- Package Manager:  `npm@7.17.0`
- Builder:          `vite`
- User Config:      `modules`
- Runtime Modules:  `@nuxt/content@2.1.1-27729314.5fc042b`
- Build Modules:    `-`
------------------------------

Reproduction

First noticed: https://github.com/michaelvcolianna/kiwisbybeat.net (findSurround is being used in /pages/[series]/[comic].vue)

Plain StackBlitz fork: https://stackblitz.com/edit/github-pdzf4a?file=pages%2F[...slug].vue

Expecting result

Returned array from findSurround has appropriate surrounding elements.

Actual result

Both elements of findSurround return array are null.

Describe the bug

Not sure if related to #1235, a separate findSurround() issue, I'm interpreting the docs wrong, or my content folder isn't set up right, but I can't seem to get findSurround to locate a previous or next content.

I first noticed it in my repo with numbered docs, found 1235, and tried using content-edge with no change. Whether I query using route parameters or manually with strings, the returned array is always [null,null] – I tried paring down to just one dir with 3 docs, as well as removing numbering, which did not change anything.

The same issue happened after forking https://stackblitz.com/github/nuxt/starter/tree/content and creating a quick subdirectory with 3 docs. The catchall page has hard-coded query info but I also left the dynamic info above it, commented out.

I am not seeing any errors in the console output.

Additional context

I'm not sure why npx nuxi info output for my local machine doesn't list the modules I'm using, but here they are:

  • @nuxt/image-edge@1.0.0-27719579.87dcdf2
  • @nuxt/content@2.1.1-27727951.e610874

Logs

No response

Copy link
Member

farnabaz commented Oct 18, 2022

Hey, Sorry for the late response
The first argument of findSurround function should be full path of the target content. in your example it should be:

queryContent().findSurround('/test/part2')

farnabaz added a commit that referenced this issue Oct 18, 2022
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 a pull request may close this issue.

2 participants