Skip to content

Shopping list: ticked items show unticked after a reload until something is ticked #647

Closed

Description

@LeMyst

What happens

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

  1. cook server ./seed (the seed has a config/aisle.conf), signed in as someone who can edit lists, or with sign-in off.
  2. Add Risotto to the shopping list. Some of its ingredients (e.g. dry white wine) are in no aisle, so they land in "other".
  3. Tick a few items, then reload the page.
  4. 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

  1. added a commit that references this issue on Oct 9, 2026
    41420bd
  2. added a commit that references this issue on Nov 16, 2026
    811c42f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions