fix: keep library settings when renamed on media server - #3323
fix: keep library settings when renamed on media server#3323fallenbagel wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
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 |
There was a problem hiding this comment.
Pull request overview
This PR prevents Plex and Jellyfin library sync from unintentionally clearing per-library settings (notably enabled) when a library is renamed on the media server, by matching existing libraries on stable IDs rather than on (id + name). It also preserves lastScan for Jellyfin libraries during sync to keep parity with Plex and to avoid losing scan state.
Changes:
- Update Plex library sync matching to use library
idonly (so renames don’t break existing-library lookup). - Update Jellyfin library sync matching to use library
idonly (so renames don’t flipenabledto false). - Preserve
lastScanon Jellyfin library entries during sync.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| server/routes/settings/index.ts | Jellyfin library sync now matches existing libraries by ID only and carries forward lastScan. |
| server/api/plexapi.ts | Plex library sync now matches existing libraries by ID only to preserve state across renames. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This comment was marked as resolved.
This comment was marked as resolved.
e093a22 to
30ce735
Compare
Matching on id and name meant a rename made the lookup miss, so enabled fell back to false and the library silently turned off. Section keys and Jellyfin GUIDs are stable across renames. If a key is ever reused after a deletion, the new library inherits the old one's state which is preferable to a rename disabling it.
30ce735 to
6aebf6f
Compare
Description
Two ways library sync loses state.
existingwas resolved with a compound match on id and name, so renaming a library on the media server made the lookup miss andenabled: existing?.enabled ?? falsesilently turned it off. Plex section keys and Jellyfin item GUIDs are stable across renames, so matching on id alone is enough.The Jellyfin mapping also never carried
lastScan, unlikePlexAPI.syncLibraries(). That one is inert today,lastScanis only read by the Plex scanner, for its recently-added scan window, but for symmetrical purposes and if the Jellyfin scanner ever grows an incremental path.Note
Found while reviewing #3321 and stacked on it because that PR moves the Jellyfin sync block into its new route.
How Has This Been Tested?
{no need)
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extractSummary by CodeRabbit