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

fix: navigation dir confs handle missing query params #2772

Merged
merged 2 commits into from
Sep 12, 2024

Conversation

hi-zp
Copy link
Contributor

@hi-zp hi-zp commented Sep 8, 2024

πŸ”— Linked issue

resolves #2771

❓ Type of change

  • πŸ“– Documentation (updates to the documentation or readme)
  • 🐞 Bug fix (a non-breaking change that fixes an issue)
  • πŸ‘Œ Enhancement (improving an existing functionality like performance)
  • ✨ New feature (a non-breaking change that adds functionality)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

πŸ“š Description

πŸ“ Checklist

  • I have linked an issue or discussion.
  • I have updated the documentation accordingly.

Comment on lines 35 to 37
const dirConfigs = await serverQueryContent(event)
const dirConfigs = await serverQueryContent(event, query)
.where({ _path: /\/_dir$/i, _partial: true })
.find()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using user's query in configs search might result in loosing some configs. Imagine user filter documents based on their path or title.

What if we use first retrieved content to get the locale and use it in configs query?

const dirConfigs = await serverQueryContent(event, contents.length ? { _locale: contents[0]._length } : {})
    .where({ _path: /\/_dir$/i, _partial: true })
    .find()

Copy link
Member

@farnabaz farnabaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@farnabaz farnabaz merged commit f36d854 into nuxt:main Sep 12, 2024
3 checks passed
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 this pull request may close these issues.

The configuration in _dir.yml does not take effect when using i18n.
2 participants