Skip to content

fix(web): label home sections by the preset their config matches - #1503

Merged
Quick104 merged 1 commit into
mainfrom
fix/issue-1500-tmdb-trending-week-label
Sep 26, 2026
Merged

Quick104 merged 1 commit into
mainfrom
fix/issue-1500-tmdb-trending-week-label

Conversation

@Quick104

@Quick104 Quick104 commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

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_discover and differ only in window. Other types have the same problem: a trending_on_server section with window: 7d reads "Trending Now (24h)".

Approach

A new matchRecipePreset helper in web/src/lib/recipes.ts picks the preset whose default_params all 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 keeps window: week.

This is a frontend-only change. The API, clients, and jellycompat don't expose these labels.

Validation

  • Web lint, format check, build, bundle budget, and make test-web: pass. The new unit tests cover matching the daily and weekly TMDB presets and the fallback when nothing matches.
  • Ran Vite against shared dev with a daily and a weekly TMDB trending section added in the browser. The capture script intercepted the admin sections response, so shared dev was not changed. On main both sections read "TMDB Trending Today"; with this change the weekly one reads "TMDB Trending This Week" in both the list and the editor.
  • On shared dev's real sections, "Trending on Server" (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_discover section created through the API with no window, which the server treats as weekly but the UI labels "TMDB Trending Today". Gallery and editor sections always carry the preset params.

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.

AI Disclosure

  • Harness: Claude Code desktop scheduled task
  • Tool(s): Claude Code, GitHub CLI, Playwright (capture script)
  • Model(s): claude-opus-5-5
  • Involvement: Fully AI-generated, human verified
  • Adversarial review: n/a

🤖 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 matchRecipePreset in 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. recipeLabel and the recipe selector in SectionEditorDrawer.tsx use this; non-selected recipe types still show their first preset.

  • Behavioral Change: recipeLabel in 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.

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]>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

Next included review available in 32 minutes.

Check out review usage here.

View limit details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 7a2baf95-c8f6-43ef-b0b1-f94f659edc91

📥 Commits

Reviewing files that changed from the base of the PR and between 96a0b7e and a7b366a.

📒 Files selected for processing (4)
  • web/src/components/sections/EditableSectionRows.test.tsx
  • web/src/components/sections/EditableSectionRows.tsx
  • web/src/components/sections/SectionEditorDrawer.tsx
  • web/src/lib/recipes.ts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@macroscopeapp

macroscopeapp Bot commented Sep 26, 2026

Copy link
Copy Markdown

Approvability

Verdict: Approved at a7b366a

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.

@Quick104
Quick104 merged commit d77371d into main Sep 26, 2026
11 checks passed
@Quick104
Quick104 deleted the fix/issue-1500-tmdb-trending-week-label branch September 26, 2026 06:30
@zZebrahz zZebrahz mentioned this pull request Sep 26, 2026
6 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant