~/talk

Local state and server cache: finding a balance

Talkat CityJS Athens 2022 · 2022-05-25..05-27· [vue, frontend-architecture]
slides:none on file

Shows a concrete pattern for avoiding duplicated REST calls by using vue-query with Vue and Pinia plus axios: fetch list and item endpoints with useQuery(['characters'], fetch) and useQuery(['character', id], fetchById), supply placeholderData to avoid undefined states, set staleTime=5000ms to keep results cached, and disable default retries:3 and refetch-on-window-focus when undesired. Live demo proves cache prevents duplicate requests, supports select transforms, and notes mutations can update the cache though mutation code is not shown.

AI-written summary · about

  1. 0:00Introduction to local state
  2. 2:34Adding server data to the mix
  3. 7:33Problems with server data in state
  4. 9:58Solution with Vue Query
  5. 10:22Live coding with Vue Query
  6. 17:50Caching and stale time
  7. 21:38Mutations and summary
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.