Skip to content

feat(nuxt): allow configuring default <NuxtLink> options#23724

Merged
danielroe merged 3 commits intomainfrom
10-17-feat/nuxt-link-defaults
Oct 18, 2023
Merged

feat(nuxt): allow configuring default <NuxtLink> options#23724
danielroe merged 3 commits intomainfrom
10-17-feat/nuxt-link-defaults

Conversation

@danielroe
Copy link
Member

@danielroe danielroe commented Oct 17, 2023

🔗 Linked issue

❓ Type of change

  • 📖 Documentation (updates to the documentation, readme or JSdoc annotations)
  • 🐞 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)
  • 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This PR allows configuring NuxtLink defaults, such as trailing slash behaviour and default classes/prefetch behaviour. All of these are serialisable and initially can be set in experimental.defaults.nuxtLink but we will likely want to move to appConfig or app/ directory later on.

Example:

export default defineNuxtConfig({
  experimental: {
    defaults: {
      nuxtLink: {
        activeClass: 'nuxt-link-active',
        trailingSlash: 'append'
      }
    }
  }
})

📝 Checklist

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

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@danielroe
Copy link
Member Author

danielroe commented Oct 17, 2023

Current dependencies on/for this PR:

This comment was auto-generated by Graphite.

@danielroe danielroe changed the title feat/nuxt-link-defaults feat(nuxt): allow configuring default <NuxtLink> options Oct 17, 2023
@danielroe danielroe requested a review from lihbr October 17, 2023 15:09
@danielroe danielroe self-assigned this Oct 17, 2023
@danielroe danielroe requested a review from atinux October 17, 2023 15:12
@danielroe danielroe marked this pull request as ready for review October 17, 2023 15:12
Copy link
Member

@lihbr lihbr left a comment

Choose a reason for hiding this comment

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

LGTM, I had concerns about default serialization behavior if users provided null/undefined/false to experimental.defaults.nuxtLink but defu + TypeScript should prevent that 👌

@danielroe danielroe merged commit 9dd3046 into main Oct 18, 2023
@danielroe danielroe deleted the 10-17-feat/nuxt-link-defaults branch October 18, 2023 12:43
@github-actions github-actions bot mentioned this pull request Oct 18, 2023
@TheAlexLichter
Copy link
Member

I had concerns about default serialization behavior

Came to my mind too but I also think that should be fine 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants