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

feat(composables): add options parameter #2065

Merged
merged 5 commits into from
May 16, 2023
Merged

feat(composables): add options parameter #2065

merged 5 commits into from
May 16, 2023

Conversation

dargmuesli
Copy link
Collaborator

@dargmuesli dargmuesli commented May 11, 2023

πŸ”— Linked issue

Resolves #2064

❓ 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

It might be necessary to override the route, e.g. to use to as given in middlewares. I've added options to the composables which allow overriding all data, so that the following becomes possible:

<script setup lang="ts">
import { useMaevsiStore } from '~/store'

definePageMeta({
  middleware: [
    (to) => {
      const localePath = useLocalePath({ route: to })
    },
  ],
})
</script>

I'm open to alternative suggestions!

πŸ“ Checklist

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

It might be necessary to override the route, e.g. to use `to` as given in middlewares.
@kazupon
Copy link
Collaborator

kazupon commented May 16, 2023

@ineshbose
Could you review this PR? πŸ™

docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
docs/content/4.API/1.composables.md Outdated Show resolved Hide resolved
src/runtime/composables.ts Show resolved Hide resolved
@ineshbose
Copy link
Collaborator

This is a really good addition - works great! Thank you ❀️

@ineshbose ineshbose merged commit b79c689 into nuxt-modules:next May 16, 2023
@dargmuesli dargmuesli deleted the feat/composables/options branch May 16, 2023 10:41
DarthGigi pushed a commit to DarthGigi/i18n that referenced this pull request Apr 16, 2024
* feat(composables): add options parameter

It might be necessary to override the route, e.g. to use `to` as given in middlewares.

* Update docs/content/4.API/1.composables.md

* Update docs/content/4.API/1.composables.md

* Update docs/content/4.API/1.composables.md

* Update docs/content/4.API/1.composables.md

---------

Co-authored-by: Inesh Bose <[email protected]>
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.

fix(composables): useRoute inside middleware
3 participants