perf: ask for previews the size they are shown at - #31
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #31 +/- ##
==========================================
+ Coverage 84.33% 84.75% +0.42%
==========================================
Files 36 36
Lines 2432 2467 +35
Branches 486 499 +13
==========================================
+ Hits 2051 2091 +40
+ Misses 377 372 -5
Partials 4 4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
`x` and `y` were the whole display, in device pixels, for every image whatever the space it was shown in: a 4K HiDPI client had the server render 7680x4320 for a photo beside an open sidebar. The handler knows what room it has, so it asks for that, capped at the display and rounded up to a multiple of 256 so a window a few pixels wider reuses the preview the server already has rather than starting a new render. Three more of the same kind. The one import of the `@nextcloud/vue` barrel is now the component itself, and the svg sanitizer is loaded from the branch that sanitizes rather than with every image; both are guarded by a test over the sources, as neither shows up in a unit test. The plyr controls take their listeners once instead of on every update, which a resize triggers many times over. And a folder listing is dropped when the viewer is asked for something else, instead of running to completion for a folder nobody is looking at. Assisted-by: ClaudeCode:claude-opus-5 Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
skjnldsv
force-pushed
the
perf/preview-and-bundle
branch
from
September 10, 2026 16:25
0776bc8 to
3e87a70
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Every image preview was requested at the full size of the display, in device pixels, whatever space it was actually shown in:
On a 4K HiDPI client that is 7680x4320 asked of the preview endpoint for a photo shown beside an open sidebar, and the server renders and caches one preview per size asked for. The handler knows the room it has, so it asks for that, capped at what the display can show and rounded up to a multiple of 256 so a window a few pixels wider reuses the preview that already exists instead of starting a new render.
Three smaller ones of the same kind:
@nextcloud/vuebarrel import is now the component itself, so a consumer's bundler is not handed the whole library for a loading spinner:from "@nextcloud/vue/components/NcLoadingIcon"indist/chunks/Images.mjsimport("dompurify")is the only reference left in that chunkaddEventListenercalls across two updates before, 0 after)Six tests fail without the changes. The two source-level guards in
__tests__/imports.spec.tsare there because neither import shows up in a unit test, only in the built chunk.Left out on purpose: caching the sorting config across
openFoldercalls, which would save one small request per folder open at the cost of showing a stale order after the user changes their sorting, with no event to invalidate it on.👾 This pull request was assisted by Claude Code, commits carry an
Assisted-bytrailer.