Skip to content

Commit

Permalink
fix(pinia): passing getters on inspectorStateUpdated (#122)
Browse files Browse the repository at this point in the history
  • Loading branch information
Azurewarth0920 authored Dec 30, 2023
1 parent f04ff0e commit a34c3d9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/core/src/bridge/devtools.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ export class BridgeRpc {
const _payload = parse(payload)
options.inspectorId === _payload.inspectorId && cb({
state: _payload.state,
getters: _payload.getters,
} as T)
})
},
Expand Down
3 changes: 3 additions & 0 deletions packages/playground/src/App.preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ const app = useAppStore()
<p>
Pinia State Count: {{ app.count }}
</p>
<p>
Pinia Getter DoubledCount: {{ app.doubledCount }}
</p>
<button @click="app.increment">
Increment Count (Pinia)
</button>
Expand Down
5 changes: 3 additions & 2 deletions packages/playground/src/stores/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { computed, ref } from 'vue'

export const useAppStore = defineStore('app', () => {
const count = ref(120)
function increment() {
count.value++
}
const doubledCount = computed(() => count.value * 2)

return { count, increment }
return { count, doubledCount, increment }
})

export const useCounterStore = defineStore('counter', () => {
Expand Down

0 comments on commit a34c3d9

Please sign in to comment.