Skip to content

Commit

Permalink
chore: remove leftovers playground
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed May 14, 2024
1 parent 08ec44a commit 1fb2a17
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 11 deletions.
4 changes: 0 additions & 4 deletions playground/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@
<RouterLink to="/contacts">
Contacts
</RouterLink>
|
<RouterLink to="/ecom">
T-shirts
</RouterLink>
</nav>
</div>
</header>
Expand Down
4 changes: 2 additions & 2 deletions playground/src/composables/contacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ import { defineQuery, useQuery } from '@pinia/colada'
import { useRouteQuery } from '@vueuse/router'
import { searchContacts } from '@/api/contacts'

export const useContacts = defineQuery(() => {
export const useContactSearch = defineQuery(() => {
const searchText = useRouteQuery('search', '', { mode: 'push' })
const { ...query } = useQuery({
key: () => ['contacts-search', { searchText: searchText.value }],
query: ({ signal }) => searchContacts(searchText.value, {}, { signal }),
gcTime: 0,
staleTime: 0,
})
return { ...query, searchText }
})
7 changes: 2 additions & 5 deletions playground/src/pages/contacts.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
<script lang="ts" setup>
import { useRouteQuery } from '@vueuse/router'
import { useContacts } from '@/composables/contacts'
import { useContactSearch } from '@/composables/contacts'
const searchText = useRouteQuery('search', '', { mode: 'push' })
const { data: searchResult, status } = useContacts()
const { data: searchResult, status, searchText } = useContactSearch()
// TODO: tip in tests if they are reading data, error or other as they are computed properties, on the server they won't
// update so they will keep their initial undefined value
Expand Down

0 comments on commit 1fb2a17

Please sign in to comment.