Skip to content

fix: keep library settings when renamed on media server - #3323

Open
fallenbagel wants to merge 1 commit into
fix/library-endpoints-mutating-on-getfrom
fix/preserve-library-state-on-sync
Open

fix: keep library settings when renamed on media server#3323
fallenbagel wants to merge 1 commit into
fix/library-endpoints-mutating-on-getfrom
fix/preserve-library-state-on-sync

Conversation

@fallenbagel

@fallenbagel fallenbagel commented Jul 30, 2026

Copy link
Copy Markdown
Member

Description

Two ways library sync loses state.

existing was resolved with a compound match on id and name, so renaming a library on the media server made the lookup miss and enabled: existing?.enabled ?? false silently 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, unlike PlexAPI.syncLibraries(). That one is inert today, lastScan is 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:

  • I have read and followed the contribution guidelines.
  • Disclosed any use of AI (see our policy)
  • I have updated the documentation accordingly.
  • All new and existing tests passed.
  • Successful build pnpm build
  • Translation keys pnpm i18n:extract
  • Database migration (if required)

Summary by CodeRabbit

  • Bug Fixes
    • Library settings now remain associated with the correct Plex or Jellyfin library even after its name changes.
    • Enabled/disabled status is preserved during library synchronization.
    • Jellyfin libraries now retain their previous scan history when synchronized.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 78020969-2468-4ec6-b50c-d0ee837a441b

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • ✅ Review completed - (🔄 Check again to review again)

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.

@fallenbagel fallenbagel changed the title fix/preserve library state on sync fix: keep library settings when renamed on media server Jul 30, 2026
@fallenbagel
fallenbagel marked this pull request as ready for review July 30, 2026 20:58
@fallenbagel
fallenbagel requested a review from a team as a code owner July 30, 2026 20:58
Copilot AI review requested due to automatic review settings July 30, 2026 20:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 id only (so renames don’t break existing-library lookup).
  • Update Jellyfin library sync matching to use library id only (so renames don’t flip enabled to false).
  • Preserve lastScan on 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.

@github-actions github-actions Bot added the merge conflict Cannot merge due to merge conflicts label Jul 30, 2026
@github-actions

This comment was marked as resolved.

@fallenbagel
fallenbagel force-pushed the fix/preserve-library-state-on-sync branch from e093a22 to 30ce735 Compare July 30, 2026 21:12
Copilot AI review requested due to automatic review settings July 30, 2026 21:12
@github-actions github-actions Bot removed the merge conflict Cannot merge due to merge conflicts label Jul 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread seerr-api.yml Outdated
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.
Copilot AI review requested due to automatic review settings July 30, 2026 21:22
@fallenbagel
fallenbagel force-pushed the fix/preserve-library-state-on-sync branch from 30ce735 to 6aebf6f Compare July 30, 2026 21:22

This comment was marked as duplicate.

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.

4 participants