Skip to content

fix(routes): restore plugin builds with current router error types - #244

Merged
rlauuzo merged 1 commit into
masterfrom
capy/restore-plugin-builds-with
Sep 17, 2026
Merged

rlauuzo merged 1 commit into
masterfrom
capy/restore-plugin-builds-with

Conversation

@rlauuzo

@rlauuzo rlauuzo commented Sep 17, 2026

Copy link
Copy Markdown
Member

The plugin release builds fail during pnpm build:plugin because the shared detail-route error component requires Error, while TanStack Router now supplies unknown. That mismatch rejects all four detail routes and also breaks inference of the player loader’s fetchSegments dependency.

Use the router’s ErrorComponentProps contract and narrow Error instances before reading their message. Other thrown values use the existing generic fallback. This restores type inference without changing the route loaders, dependencies, or compiler settings. Eight regression cases cover Error and non-Error throws.

Verified with pnpm 10: build:plugin (including TypeScript), 85 related tests across seven files, scoped lint, and formatting. Browser checks cover the invalid-player-ID error page, Home recovery, and opening an episode with fetched segments. The rebuilt assets were also embedded in the companion Jellyfin 12.1 plugin build and served successfully by a real 12.1 server.

This must land on master before the companion plugin build can pass CI, since that workflow checks out frontend master.

Open in Capy

Summary by Sourcery

Restore plugin build compatibility with current router error types while preserving detail-route error handling.

Bug Fixes:

  • Restore plugin builds by aligning the shared detail-route error component with TanStack Router’s current error contract and safely handling non-Error thrown values.

Tests:

  • Add regression coverage for preserving Error messages and using the generic fallback for non-Error values.

@sourcery-ai

sourcery-ai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Reviewer's Guide

Updates the shared detail-route error component to use TanStack Router’s ErrorComponentProps and safely narrow unknown errors, restoring plugin build compatibility without changing route loaders or compiler settings. Adds focused regression tests covering eight Error and non-Error cases.

Sequence diagram for detail-route error fallback

sequenceDiagram
    participant Router as TanStack Router
    participant DetailError as DetailRouteErrorComponent
    participant Fallback as RouteErrorFallback

    Router->>DetailError: render(error: unknown)
    alt error instanceof Error
        DetailError->>Fallback: render(message: error.message)
    else non-Error thrown value
        DetailError->>Fallback: render(message: undefined)
    end
Loading

File-Level Changes

Change Details Files
Align the shared detail-route error component with TanStack Router’s current error contract and preserve safe message handling.
  • Accept ErrorComponentProps, allowing router-provided unknown errors and restoring route/player loader type inference.
  • Only display error.message for actual Error instances; delegate all other thrown values to the existing generic fallback.
src/routes/-detail-route-error-component.tsx
Add regression coverage for Error and non-Error route failures.
  • Verify Error messages are rendered unchanged.
  • Verify nullish, primitive, object, and invalid-message values use the generic fallback.
src/__tests__/detail-route-error-component.test.tsx

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

Copy link
Copy Markdown

React Doctor found no new issues. 🎉

Reviewed by React Doctor for commit f76d0ad.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@capy-ai capy-ai Bot 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.

Capy found no issues.

View 1 other finding in Capy.

Open in Capy

@kilo-code-bot

kilo-code-bot Bot commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (2 files)
  • src/__tests__/detail-route-error-component.test.tsx
  • src/routes/-detail-route-error-component.tsx

Reviewed by gpt-5.6-luna · Input: 0 · Output: 0 · Cached: 0

@rlauuzo
rlauuzo merged commit 1d5a506 into master Sep 17, 2026
6 checks passed
@rlauuzo
rlauuzo deleted the capy/restore-plugin-builds-with branch September 17, 2026 13:10
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