feat(useLocale,useFeatures): enable reactive registry by default#211
Merged
Conversation
Pass `reactive: true` to the internal registries so consumers get
reactive collection reads and per-ticket mutation propagation without
having to opt in.
- `useLocale` exposes `size`, `keys()`, `values()`, `entries()` — all
untracked against a plain Map until now. Most usage sticks to `t()`
and `selectedId` (already reactive), but a template listing
registered locales would silently miss register/unregister.
- `useFeatures` is worse — its headline API `variation(id)` reads
`registry.get(id)` on a plain Map, so templates using
`v-if="features.variation('flag-x')"` never reacted to `sync()`
calls updating flag values from a remote adapter.
Same rationale as #210 for `useTheme`: these are product composables,
small collections, and users expect a Vue-reactive service from the
name.
|
commit: |
johnleider
added a commit
that referenced
this pull request
Apr 23, 2026
- `.claude/rules/composables.md`: new section "Plugins and Reactive Defaults" covering the primitive/plugin tiers, when to pass `reactive: true` to an internal registry, the two-registry architecture, and how `reactive: true` and `useProxyRegistry` complement each other. - `PHILOSOPHY.md §4.4`: rewrite from "the reactive: true footgun" to "Registry reactivity". The footgun described (values() cache dropping Vue dep tracking) was closed in #209 — that section was actively teaching the wrong mental model through #210, #211, and #212. New text positions `reactive: true` and `useProxyRegistry` as two valid complementary options. - `PHILOSOPHY.md §6.7`: revise the closing warning that said "do not substitute reactive: true on the registry itself" — same reason. Refs #208 #209 #210 #211 #212
johnleider
added a commit
that referenced
this pull request
Apr 23, 2026
#213) - `.claude/rules/composables.md`: new section "Plugins and Reactive Defaults" covering the primitive/plugin tiers, when to pass `reactive: true` to an internal registry, the two-registry architecture, and how `reactive: true` and `useProxyRegistry` complement each other. - `PHILOSOPHY.md §4.4`: rewrite from "the reactive: true footgun" to "Registry reactivity". The footgun described (values() cache dropping Vue dep tracking) was closed in #209 — that section was actively teaching the wrong mental model through #210, #211, and #212. New text positions `reactive: true` and `useProxyRegistry` as two valid complementary options. - `PHILOSOPHY.md §6.7`: revise the closing warning that said "do not substitute reactive: true on the registry itself" — same reason. Refs #208 #209 #210 #211 #212
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Pass
reactive: trueto the internal registries inuseLocaleanduseFeaturesso consumers get reactive collection reads and per-ticket mutation propagation without having to opt in.Rationale
Same audit, same shape as #210:
useLocale— exposessize,keys(),values(),entries()over a plainMap. Most real-world usage is throught()andselectedId(already reactive), but a template listing registered locales would silently missregister()/unregister().useFeatures— the higher-priority case. Its headline API,variation(id), readsregistry.get(id)on a plainMap. Templates usingv-if="features.variation('new-checkout')"don't react whensync()updates flag values from a remote adapter. Sincesync()is called on every remote-flag update, this is the primary way the composable is meant to be used.Both are product composables (users expect a Vue-reactive service from the name) with tiny collections (a handful of locales, a handful of flags), so the
shallowReactiveoverhead is negligible.Verification
pnpm typecheck— clean.pnpm vitest run useLocale useFeatures— 136 tests passing.pnpm lint:fix— clean.