Skip to content

Fix: Build warnings: svelte-kit sync prepare step, reactive shortcuts, and stale QR/link URL#666

Merged
JW-CH merged 1 commit into
immichFrame:mainfrom
JoeRu:fix-build-warnings-clean
Jul 7, 2026
Merged

Fix: Build warnings: svelte-kit sync prepare step, reactive shortcuts, and stale QR/link URL#666
JW-CH merged 1 commit into
immichFrame:mainfrom
JoeRu:fix-build-warnings-clean

Conversation

@JoeRu

@JoeRu JoeRu commented Jul 5, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes three build-time warnings seen in immichFrame.Web:

  • Missing svelte-kit sync prepare step: vite build warns Cannot find base config file "./.svelte-kit/tsconfig.json" on a fresh checkout, since .svelte-kit/ doesn't exist yet when Vite first reads tsconfig.json. Added the standard "prepare": "svelte-kit sync" script (the usual create-svelte scaffold entry) so npm i generates it automatically before npm run build ever runs.
  • overlay-controls.svelte reactivity warning: shortcutList was built once as a plain const from the next/back/pause/showInfo props instead of reactively. Wrapped it in $derived(...), matching the Svelte 5 compiler's own suggested fix.
  • overlay-qr.svelte stale QR/link (actual bug): imageUrl (used for both the QR code and the "Open in immich" link) was computed once from the id prop at component init. Since image-overlay.svelte renders <OverlayQr id={asset.id} /> without forcing a remount, the QR code and link would silently keep pointing at whatever asset was current the first time the component was created, even as the slideshow advanced underneath. Wrapped imageUrl in $derived(...) so it now tracks the current asset.

No Dockerfile, docker-compose.yml, or config changes — this is a 3-line, 3-file fix.

Test plan

  • npm run check (svelte-check) — 0 errors, 0 warnings
  • npm run build — confirmed all four warning strings (Cannot find base config file, overlay-controls.svelte, overlay-qr.svelte, state_referenced_locally) are gone from the output
  • Real docker build of this branch — same warnings confirmed absent from the full build log
  • Live browser regression check: opened the info overlay, let the slideshow advance (~23s), reopened it, and confirmed the "Open in immich" link's asset id changed to match the newly-displayed asset instead of staying frozen on the first one shown
  • Confirmed the keyboard shortcuts (overlay-controls.svelte) still work correctly (tested the i shortcut for opening the info overlay)

Summary by CodeRabbit

  • Bug Fixes
    • Improved the reliability of QR code links and on-screen shortcut behavior so they stay up to date more consistently.
  • Chores
    • Added a package setup step to better support project installation and preparation flows.

Copilot AI review requested due to automatic review settings July 5, 2026 18:57
@coderabbitai

coderabbitai Bot commented Jul 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR adds a prepare script running svelte-kit sync in package.json, and converts static values in two Svelte components (overlay-qr.svelte, overlay-controls.svelte) into $derived reactive computations for imageUrl and shortcutList.

Changes

Reactivity and Build Tooling Updates

Layer / File(s) Summary
Reactive derived values in overlay components
immichFrame.Web/src/lib/components/elements/imageoverlay/overlay-qr.svelte, immichFrame.Web/src/lib/components/elements/overlay-controls.svelte
imageUrl and shortcutList are converted from static computed/literal values to Svelte $derived(...) reactive values.
Package prepare script addition
immichFrame.Web/package.json
A prepare script running svelte-kit sync is added to the scripts section.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: maintenance

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main fixes: the prepare step and the two reactive Svelte updates.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

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 removes Svelte/SvelteKit build-time warnings in immichFrame.Web and fixes a real runtime issue where the QR/link in the info overlay could remain stuck on the first-rendered asset as the slideshow advances.

Changes:

  • Add an npm prepare script to run svelte-kit sync on install so .svelte-kit/tsconfig.json exists before vite build.
  • Make overlay-controls.svelte shortcut list reactive via $derived(...) to satisfy Svelte 5 reactivity expectations.
  • Fix stale “Open in immich” link / QR data in overlay-qr.svelte by deriving imageUrl from the reactive id prop.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
immichFrame.Web/src/lib/components/elements/overlay-controls.svelte Makes the keyboard shortcut list reactive via $derived to eliminate reactivity warnings.
immichFrame.Web/src/lib/components/elements/imageoverlay/overlay-qr.svelte Derives imageUrl from id to keep QR/link updated as the displayed asset changes.
immichFrame.Web/package.json Adds prepare: svelte-kit sync so .svelte-kit artifacts exist on fresh installs before builds.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@coderabbitai coderabbitai 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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
immichFrame.Web/src/lib/components/elements/overlay-controls.svelte (1)

32-68: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Add an update handler to shortcuts

use:shortcuts={shortcutList} won’t react to prop changes unless the action exposes update(newList). As written, the keydown listener stays bound to the mount-time callbacks, so the inline handlers passed from home-page.svelte can go stale on later renders.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@immichFrame.Web/src/lib/components/elements/overlay-controls.svelte` around
lines 32 - 68, The `shortcuts` action in `overlay-controls.svelte` only handles
mount and destroy, so it won’t react when `shortcutList` changes and the
`keydown` listener can keep stale callbacks. Add an `update(newList)` method to
`shortcuts` that refreshes the stored shortcut list used by `handleKeyDown`, and
make sure `use:shortcuts={shortcutList}` in the same component can rebind to the
latest `next`, `back`, `pause`, and `showInfo` actions after rerenders.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@immichFrame.Web/src/lib/components/elements/overlay-controls.svelte`:
- Around line 32-68: The `shortcuts` action in `overlay-controls.svelte` only
handles mount and destroy, so it won’t react when `shortcutList` changes and the
`keydown` listener can keep stale callbacks. Add an `update(newList)` method to
`shortcuts` that refreshes the stored shortcut list used by `handleKeyDown`, and
make sure `use:shortcuts={shortcutList}` in the same component can rebind to the
latest `next`, `back`, `pause`, and `showInfo` actions after rerenders.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: df2ff92f-850f-4fda-a28e-24878685d53b

📥 Commits

Reviewing files that changed from the base of the PR and between 682fdc4 and dc30a27.

📒 Files selected for processing (3)
  • immichFrame.Web/package.json
  • immichFrame.Web/src/lib/components/elements/imageoverlay/overlay-qr.svelte
  • immichFrame.Web/src/lib/components/elements/overlay-controls.svelte

@JW-CH JW-CH added the fix Something was fixed label Jul 7, 2026
@JW-CH JW-CH changed the title Fix build warnings: svelte-kit sync prepare step, reactive shortcuts, and stale QR/link URL Fix: Build warnings: svelte-kit sync prepare step, reactive shortcuts, and stale QR/link URL Jul 7, 2026
@JW-CH JW-CH merged commit bdc6094 into immichFrame:main Jul 7, 2026
7 of 9 checks passed
@JoeRu JoeRu deleted the fix-build-warnings-clean branch July 7, 2026 20:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Something was fixed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants