Repository navigation
fix(web): label home sections by the preset their config matches - #1503
Conversation
Several gallery presets share one section type and differ only in their params, such as TMDB Trending Today and This Week. The section list and the editor's type menu always used the type's first preset, so a weekly trending section read "TMDB Trending Today". Match the section's config against each preset's default params and use the best match. Fixes #1500 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
|
Warning Review limit reachedNext included review available in 32 minutes. View limit detailsLimit details: You’ve used all 2 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This is a localized frontend bug fix that improves section labels by matching existing configuration to catalog presets. It adds focused tests and does not alter persisted data, APIs, or section processing behavior. You can add or adjust custom eligibility rules. Learn more. |
Problem
Related issue: #1500
Validation tasks: touches #1141 C1 and #194 (section type labels in Web admin); neither has a passed case
A home section added from the gallery as TMDB Trending This Week shows up as "TMDB Trending Today" in the Web admin section list and in the editor's Section Type menu. The section works correctly; only the label is wrong, so admins can't tell which trending list a section uses without comparing its items.
The cause is shared by every section type that has more than one gallery preset. The UI labels a section with its type's first preset, but presets of one type differ only in their params. The daily and weekly TMDB presets are both
trending_discoverand differ only inwindow. Other types have the same problem: atrending_on_serversection withwindow: 7dreads "Trending Now (24h)".Approach
A new
matchRecipePresethelper inweb/src/lib/recipes.tspicks the preset whosedefault_paramsall match the section's config. When several match, it takes the one that matches the most keys; when none match, it falls back to the first preset, which is what the UI showed before. The section list badge, the drag overlay, and the editor's label for the selected type all use it. The editor already kept the section's own params when it opened an existing section, so saving a weekly section keepswindow: week.This is a frontend-only change. The API, clients, and jellycompat don't expose these labels.
Validation
make test-web: pass. The new unit tests cover matching the daily and weekly TMDB presets and the fallback when nothing matches.window: 7d) now reads "Trending This Week" instead of "Trending Now (24h)", and the Continue Listening row reads "Continue Listening". No new console errors.Risks
A section whose config matches no preset still shows the first preset's name. One example is a
trending_discoversection created through the API with nowindow, which the server treats as weekly but the UI labels "TMDB Trending Today". Gallery and editor sections always carry the preset params.Checklist
AI Disclosure
🤖 Generated with Claude Code
Note
Label home section UI by matching preset config
Home section badges and recipe type options now show the preset whose default parameters match the section's config, instead of always showing the first preset. Adds
matchRecipePresetin recipes.ts — it compares preset defaults via JSON-stringified equality, picks the preset with the most matching entries, keeps declaration order on ties, and falls back to the first preset when nothing matches.recipeLabeland the recipe selector in SectionEditorDrawer.tsx use this; non-selected recipe types still show their first preset.recipeLabelin EditableSectionRows.tsx takes an optional section config and may now return a different label than before when multiple presets share a recipe type.Macroscope summarized a7b366a.