You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Shopping list: ticked items show unticked after a reload until something is ticked #647
On the shopping list page, items that are already ticked show up unticked after a reload. Ticking (or unticking) any item makes every other tick reappear at once. The ticks themselves are fine on the server — only the page loses them.
Steps to reproduce
cook server ./seed (the seed has a config/aisle.conf), signed in as someone who can edit lists, or with sign-in off.
Add Risotto to the shopping list. Some of its ingredients (e.g. dry white wine) are in no aisle, so they land in "other".
Tick a few items, then reload the page.
The ticks show for a moment, then every box is empty. Tick anything: all the earlier ticks come back.
Cause
A regression from 637cc4d (#631), which added the "Assign aisle…" picker to the "other" group.
In templates/shopping_list.html:
refreshList() renders the list with displayShoppingList(data), then ticks the boxes with applyServerChecked(data.checked) → applyCheckedStates(). By design the rendered markup carries no ticks.
displayShoppingList() starts loadAisleNames() (not awaited) when there is an "other" group and the viewer can edit lists.
When GET /api/aisles answers, loadAisleNames() calls displayShoppingList(lastListData) again so the pickers appear. The markup now differs, so setHtml() replaces #list-content with fresh, unticked checkboxes — and nothing calls applyCheckedStates() after it.
checkedItems still holds the right ticks in memory, which is why the next tick (which ends in applyCheckedStates()) brings them all back.
It needs an aisle file and at least one ingredient in "other", which is the usual case, and a viewer allowed to edit lists (readers never get the picker).
Fix
Re-apply the ticks at the end of every render (displayShoppingList() ends with applyCheckedStates()), so any caller that redraws the checkboxes gets them ticked again from checkedItems.
Activity
fix(web): keep the shopping list ticks when the aisle picker appears
fix(web): keep the shopping list ticks when the aisle picker appears (c…