Repository navigation
fix(dashboard): apply sorting in the by-product view (fixes #241) - #247
Merged
Merged
Conversation
The grouped view was handed only the search query and active tag, so every option in the sort dropdown changed state that nothing in that view read. Selecting one did nothing and said nothing. Sorting listings and sorting items are different questions: an item has no price, currency, schedule or check history of its own, only the stores selling it. Each option is therefore given an item-level meaning anchored to what the card already shows -- the best price across the item's comparable stores, in the user's own currency. Items that cannot answer an option sort last in both directions, and ties break on name then id so a polling list holds still. Closes #241
This was referenced Oct 11, 2026
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.
Fixes #241. Thanks @GeilerGelber — the report was precise and the cause was exactly where it pointed.
Root cause
ItemListwas called as<ItemList searchQuery={searchQuery} activeTag={activeTag} />. Its props interface had only those two fields and the component had no sort step at all — it filtereditemsQuery.dataand mapped straight to<ItemCard>. SosortBy/sortOrderlived inuseProductFilters, still persisted tolocalStorage, and still re-sorted the flat view — but nothing in the grouped view ever read them. The dropdown changed, the state changed, and there was no consumer. Hence no reorder and no error, which is why it looked like nothing happened rather than like a failure.What each option means for an item
New
itemSort.ts. Everything anchors to the store the card is already pointing at:bestPriceListing()returns the first listing whose id is inbest_price_listing_ids— the green-marked store the user can see — rather than inventing a second ranking they cannot observe.item.best_price— already converted to the user's currency, and already what the card printsitem.nameitem.category ?? ''— untagged is a real answerany_in_stockfirst, matching the flat view's orderingRaw
current_pricewould have ranked 15 000 JPY above 140 GBP, which is why price sorts go through the converted value.Two cross-cutting rules, both tested:
0, which puts unpriced listings ahead of a genuinely cheap one — that behaviour was deliberately not copied.Nothing was disabled
websitewas the judgement call. It stays working: today every item has exactly one listing, so it is identical to the flat view's answer for essentially all real data; for a multi-store item it resolves to the store the card already highlights; and disabling it would have meant either leaving the user's savedsortByselected-but-dead — the same silence with a greyed control — or mutating their persisted preference behind their back, which would also change the flat view.Deliberately out of scope
The pause filter and the count badge also ignore the grouped view — the filter does nothing there, and "Showing N products" counts listings rather than items. Those are filtering and counting rather than sorting, and the filter row is where #246 is about to land, so they want their own issue.
DashboardControls.tsxis untouched, so this has zero conflict surface with #246.Verification
Lint clean, build and typecheck clean, 60 frontend tests (33 on
mainplus 27 new). Playwright 20 passed on port 4401, launched from its own worktree withreuseExistingServer: falseand--strictPort; temp config deleted.Bundle ownership proved against the chunk the preview actually served, including
({searchQuery:e,activeTag:t,sortBy:n,sortOrder:r})—ItemListreceiving the sort props, which is the fix and cannot be produced by pre-change source.