~/talk

Local state and server cache: how to balance them with vue-query

Talkat JSWorld Conference 2022 · 2022-02-09..02-11· [vue, frontend-architecture]
slides:none on file

A demo replaces duplicated Vuex fetch logic with vue-query composables around a simple tractors app, showing concrete code: useQuery and useMutation, query keys like ['tractors'] and ['tractors', id], and a callback fetch for parameterized queries. It demonstrates cache controls: default retry = 3, window-focus refetching, staleTime = 10s, placeholderData, and updating the cache on mutation with setQueryData so the list reflects adds without a second network round trip.

AI-written summary · about

  1. 0:00Introduction
  2. 1:46Global state in apps
  3. 3:55Server data in local state
  4. 9:11Sync vs async state
  5. 10:39vue-query solution
  6. 11:20Live: Fetch tractors
  7. 14:58Loading and error states
  8. 16:46Reusable composables
  9. 19:37Caching and stale time
  10. 21:01Fetching single tractor data with parameters
  11. 23:14Mutating server data
  12. 25:01Updating cache after mutations
  13. 27:28Q&A
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.