Skip to content

Fix profile selects sending string ids, which root folder save drops - #280

Open
beardedslav wants to merge 1 commit into
Chaptarr:developfrom
beardedslav:fix/profile-select-numeric-id
Open

beardedslav wants to merge 1 commit into
Chaptarr:developfrom
beardedslav:fix/profile-select-numeric-id

Conversation

@beardedslav

Copy link
Copy Markdown

Description

QualityProfileSelectInputConnector and MetadataProfileSelectInputConnector pass their own onChange (which parseInts the selected id) to SelectInput, then spread {...otherProps} after it. onChange was still in otherProps, so the parent's handler replaced the connector's, and a profile picked from the dropdown reached state as a string ("3"). The root folder save keeps only numeric ids (normalizeOptionalId), so it sent null and the server rejected the folder with "A ebook quality profile is required".

This change destructures onChange out of otherProps in both connectors, so the connector's handler is the one SelectInput gets. Auto-selected values already went through the connector's handler, which is why only manual picks were affected.

The other forms that use these selects (Edit Author, Add Author, Add Root Folder inline, import lists) pass the value straight through, and now get numbers as the connectors intended. none and noChange still pass through unchanged.

Fixes #279

Database Migration

NO

How was this tested?

Built from source on macOS (yarn build, dotnet build src/Chaptarr.sln -c Release) and run against a fresh data folder. I drove Settings → Media Management → Add Root Folder in Chromium (Playwright) and captured the request:

  1. Created a second eBook quality profile ("EPUB", id 3).
  2. Add Root Folder → eBooks → picked "EPUB", switched to "E-Book" and back to "EPUB", then picked the eBook metadata profile by hand.
  3. Save.
  • Before: the request had "ebookQualityProfileId":null,"ebookMetadataProfileId":null → 400 "A ebook quality profile is required" / "An ebook metadata profile is required".
  • After: the request had "ebookQualityProfileId":3,"ebookMetadataProfileId":2 → 201, and GET /api/v1/rootFolder shows the folder with quality profile 3.

yarn typecheck passes. yarn lint reports the same 1309 pre-existing problems before and after; none are on the changed lines. The repo has no frontend test runner, so no unit test was added.

Screenshots (UI changes only)

N/A

🤖 Generated with Claude Code

QualityProfileSelectInputConnector and MetadataProfileSelectInputConnector
spread otherProps after their own onChange, so the parent's handler
replaced the one that parses the id to a number. A profile picked from
the dropdown reached state as a string, and the root folder save nulled
it, failing with "A ebook quality profile is required".

Fixes Chaptarr#279

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

[BUG] Root folder dialog sends null quality/metadata profile when picked from the dropdown

1 participant