Skip to content

Commit 8933c55

Browse files
committed
chore: fix pc usage
1 parent f2fb721 commit 8933c55

File tree

2 files changed

+4
-12
lines changed

2 files changed

+4
-12
lines changed

playground/src/pages/users/colada-loader.[id].vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts" setup>
22
import { simulateError, useUserData } from '@/loaders/colada-loaders'
3-
import { serializeTreeMap } from '@pinia/colada'
3+
import { serializeQueryCache, useQueryCache } from '@pinia/colada'
44
import { getActivePinia } from 'pinia'
55
66
definePage({
@@ -14,11 +14,7 @@ const route = useRoute('/users/colada-loader.[id]')
1414
const pinia = getActivePinia()!
1515
function copy() {
1616
console.log(
17-
JSON.parse(
18-
JSON.stringify(
19-
serializeTreeMap(pinia.state.value._pc_query.entryRegistry)
20-
)
21-
)
17+
JSON.parse(JSON.stringify(serializeQueryCache(useQueryCache(pinia))))
2218
)
2319
}
2420

playground/src/pages/users/pinia-colada.[id].vue

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms))
44

55
<script lang="ts" setup>
66
import { ref } from 'vue'
7-
import { useQuery, serializeTreeMap } from '@pinia/colada'
7+
import { serializeQueryCache, useQuery, useQueryCache } from '@pinia/colada'
88
import { getActivePinia } from 'pinia'
99
1010
const route = useRoute('/users/[id]')
@@ -14,11 +14,7 @@ const simulateError = ref(false)
1414
const pinia = getActivePinia()!
1515
function copy() {
1616
console.log(
17-
JSON.parse(
18-
JSON.stringify(
19-
serializeTreeMap(pinia.state.value._pc_query.entryRegistry)
20-
)
21-
)
17+
JSON.parse(JSON.stringify(serializeQueryCache(useQueryCache(pinia))))
2218
)
2319
}
2420

0 commit comments

Comments
 (0)