d48cda4081
CI / Test (ubuntu-latest, Node 18.x, bun) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, npm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, pnpm) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 18.x, yarn) (push) Failing after 15m1s
CI / Test (ubuntu-latest, Node 20.x, bun) (push) Failing after 17m13s
CI / Test (ubuntu-latest, Node 20.x, npm) (push) Failing after 18m42s
CI / Test (ubuntu-latest, Node 20.x, pnpm) (push) Failing after 15m0s
CI / Test (ubuntu-latest, Node 20.x, yarn) (push) Failing after 49m44s
CI / Test (ubuntu-latest, Node 22.x, bun) (push) Failing after 51m55s
CI / Test (ubuntu-latest, Node 22.x, pnpm) (push) Failing after 21m57s
CI / Test (ubuntu-latest, Node 22.x, npm) (push) Failing after 37m39s
CI / Test (ubuntu-latest, Node 22.x, yarn) (push) Failing after 34m7s
CI / Validate Components (push) Failing after 37m15s
CI / Python Tests (push) Failing after 10m1s
CI / Security Scan (push) Failing after 10m1s
CI / Lint (push) Failing after 17m12s
CI / Coverage (push) Failing after 20m19s
CI / Test (macos-latest, Node 18.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 18.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 20.x, yarn) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, bun) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (macos-latest, Node 22.x, yarn) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, npm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, pnpm) (push) Has been cancelled
CI / Test (windows-latest, Node 22.x, yarn) (push) Has been cancelled
2.4 KiB
2.4 KiB
paths
| paths | |
|---|---|
|
Vue Patterns
This file extends common/patterns.md with Vue specific content.
Composables
- The composable (
useXxx) is the reusable-logic unit. In Feature-Sliced Design it lives in the slicemodelsegment. - Accept
MaybeRefOrGetter<T>inputs and normalize withtoValue, so callers can pass a ref, a getter, or a raw value. - Return
toRefs(reactive(...))so consumers can destructure without losing reactivity. - A composable that uses lifecycle hooks or
provide/injectmust be called inside a componentsetup, not lazily or conditionally.
Props, Emits, v-model
- Type-based
defineProps<Props>()and tuple-formdefineEmits<{ change: [id: number] }>(). defineModel<T>('name', { default })for two-way binding. It compiles to a prop plus anupdate:*emit.
Provide / Inject
- Use
provide/injectfor tree-scoped data without prop drilling. - Type-safe collision-free keys:
const key = Symbol() as InjectionKey<T>. - The provider owns mutations. Expose a
readonlyref plus an explicit updater function, never a raw mutable ref.
Pinia (FSD model segment)
- Prefer setup stores:
refis state,computedis getters,functionis actions. - Setup stores do not get
$resetfor free. Define your own. - Use
storeToRefsfor state and getters. Destructure actions directly off the store. - Never persist raw auth tokens to
localStorage.
vue-router
- Lazy-load route components with dynamic
import(). - A global
beforeEachauth gate keyed onmeta.requiresAuth. Guards returnfalse(cancel), a route location (redirect), orundefined/true(continue). - Watch
() => route.params.id, not the wholerouteobject.
vue-query (server cache)
@tanstack/vue-queryowns server-cache state. Pinia owns client state.- Put request functions plus
queryOptionsfactories in the FSDapisegment. - Critical: put the ref or computed ITSELF in the query key, never
.value. Passing.valuefreezes the key and kills reactive refetch.
useQuery({ queryKey: ['auction', id], queryFn: () => fetchAuction(toValue(id)) })
// after a mutation
queryClient.invalidateQueries({ queryKey: ['auction', id] })
Reference
- ECC skills:
frontend-patterns,vite-patterns. - Docs: https://pinia.vuejs.org/ · https://router.vuejs.org/ · https://tanstack.com/query/latest/docs/framework/vue/overview · https://vuejs.org/guide/reusability/composables.html