Closed AlejandroAkbal closed 1 year ago
Context: this a bit of the code that I'm trying to use
<script lang="ts" setup>
// ...
const historyState = useHistoryState()
// ...
const {
data: initialPostPages,
pending: pendingInitialPosts,
error: errorInitialPosts,
refresh: refreshInitialPosts
} = await useAsyncData(
'posts',
() => {
const apiUrl = config.public.API_URL + '/booru/' + selectedBooru.value.type.type + '/posts'
const tags = selectedTags.value.map((tag) => tag.name).join('|')
return $fetch<IPostPage>(apiUrl, {
params: {
baseEndpoint: selectedBooru.value.domain,
limit: userSettings.postsPerPage,
pageID: selectedPage.value,
tags: tags.length > 0 ? tags : undefined,
// Filters
rating: selectedFilters.value.rating,
order: selectedFilters.value.sort,
score: selectedFilters.value.score
},
retry: 0
})
},
{
server: false,
lazy: true,
default: () => historyState.data,
immediate: !historyState.data,
transform: (data) => {
return [data]
}
}
)
onBackupState(() => initialPostPages)
</script>
I would really appreciate your help @hidekatsu-izuno
Bump
Bump
I added useRestorableState as a new SSR-friendly API on v0.14.0. It might help you. https://www.npmjs.com/package/vue-history-state#user-content-new-ssr-friendly-reactivity-apis-experimental
Can you please put an example repo / codeblitz
Because I am having a hard time using this project, which I really need