Skip to content

Commit

Permalink
feat: Add storeToRefs to the auto imports in @pinia/nuxt #1876
Browse files Browse the repository at this point in the history
  • Loading branch information
BlackCrowxyz committed Oct 2, 2023
1 parent 98b46fe commit ab2fde3
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/docs/.vitepress/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default defineConfig({
link: 'https://pinia.vuejs.kr/',
},
pt: {
label: 'Português',
lang: 'pt-PT',
link: 'https://pinia-docs-pt.netlify.app/',
label: 'Português',
lang: 'pt-PT',
link: 'https://pinia-docs-pt.netlify.app/',
},
uk: {
label: 'Українська',
Expand Down
10 changes: 10 additions & 0 deletions packages/nuxt/playground/domain/one/stores/testStore.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,14 @@
// import { storeToRefs } from "pinia"

export const useTestStore = defineStore('test', () => {
console.log('I was defined within a store directory')

// Should work without any error or importing
const { count, getCount } = storeToRefs(useCounter())
console.log(
'storeToRefs works without importing (Nuxt) !',
count.value === getCount.value
)

return {}
})
1 change: 1 addition & 0 deletions packages/nuxt/src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const module: NuxtModule<ModuleOptions> = defineNuxtModule<ModuleOptions>({
{ from: composables, name: 'defineStore' },
{ from: composables, name: 'acceptHMRUpdate' },
{ from: composables, name: 'usePinia' },
{ from: composables, name: 'storeToRefs' },
])

if (options.storesDirs) {
Expand Down

0 comments on commit ab2fde3

Please sign in to comment.