B-XOPI-the-food-pack-loads-on-page-visit-so-the-catalog-depends-on
food_corpus defaults to usda, but the pack is only seeded when the Foods page is first opened —
experiences/fitness/app/pages/apps/fitness/foods/index.vue calls loadIfWanted() on mount. Never
open Foods and neither the ~3,000 foods nor their 5,621 portions exist, despite the setting saying
they should.
Consequences:
- The catalog’s contents depend on where the user has navigated, not on the setting.
- Capture and food lookup can fail to resolve a food that the setting claims is present.
- A bundle imported into an install that has not loaded the pack lands
partialand drops the dependent rows.
Loading is also one-way. Turning food_corpus down from usda to curated or none unloads
nothing — the rows stay and the database stays the same size (~26 MB for the USDA pack, measured).
There is no unload verb anywhere: prune only removes rows of a pack left stale by a rebuild, and
reset wipes everything.
The decision to make: seed eagerly at first open to match the setting, or resolve on demand whenever a food is needed rather than when a particular page mounts. Either is a behaviour change, not a schema change.
Related: an unload path would let the setting mean what it says in both directions.