Skip to content

Improve shelf image previews and timestamp layout - #2

Merged
tarikbc merged 4 commits into
tarikbc:mainfrom
brzvsk:fix/shelf-preview-layout
Sep 11, 2026
Merged

Improve shelf image previews and timestamp layout#2
tarikbc merged 4 commits into
tarikbc:mainfrom
brzvsk:fix/shelf-preview-layout

Conversation

@brzvsk

@brzvsk brzvsk commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

What changed

  • When a file card points to an image, Space preview detects it through its Uniform Type Identifier and renders the original file as an image
  • The preview uses ImageIO downsampling sized for the larger Retina pane instead of the shelf card Quick Look thumbnail
  • The Image search filter now includes image files as well as native clipboard image items, while ordinary files stay excluded
  • Image-file filtering uses macOS content-type detection, so formats such as HEIC, WebP, SVG, and RAW do not need a hard-coded extension list
  • Combining Image and File filters still returns each matching item once
  • Non-image files keep the existing generic file preview and Quick Look action
  • Relative timestamps stay on one line instead of wrapping inside narrow cards

Testing

  • Debug app target builds successfully with Xcode 26.6
  • All 187 CopyCore tests pass, including native images, image files, mixed multi-file items, non-image files, text-plus-Image search, and Image-plus-File composition
  • Installed and launched a locally signed Debug build using the existing bundle identifier
  • git diff --check passes

brzvsk and others added 2 commits August 31, 2026 10:26
`imageFileURL` asked the file system for each URL's content type from
inside `PreviewPane.body`, so every re-render repeated the probe and a
network share or a sleeping disk could block the shelf for as long as the
volume took to answer. The probe now runs in a detached task keyed on the
card, and the pane shows the spinner `FileImagePreview` already uses while
it waits, so the generic file icon never flashes before the image.

Also records why `ImageFileDetection` stays uncached: the UTType lookup
measures 2.2 us per call, and a memo table would need a lock because a
DatabasePool calls the SQL function from several readers at once.
@tarikbc

tarikbc commented Sep 11, 2026

Copy link
Copy Markdown
Owner

Thanks, this one is the strongest of the four. The tests are exactly what I would have asked for, and registering the SQL function through prepareDatabase is the right call for a DatabasePool.

I pushed one commit to the branch rather than sending you back and forth:

  • imageFileURL asked the file system for each content type from inside PreviewPane.body, so it re-probed on every re-render and a network share could block the shelf. It now runs in a detached task keyed on the card, with the spinner FileImagePreview already has covering the wait so the generic icon never flashes first.

Two things I checked and deliberately left alone:

  • NSImage(cgImage:size: .zero) is correct. I was suspicious, so I tested it: the size resolves from the CGImage, so the aspect ratio is right.
  • I considered memoizing the UTType(filenameExtension:) lookup in ImageFileDetection, then measured it at 2.2 us per call. Ten thousand file rows would cost about 22 ms, and the lock a pool of concurrent readers would need costs more than that. I added a comment saying so, so nobody re-opens it.

Builds clean, 187 tests pass. Merging.

@tarikbc
tarikbc merged commit b016e85 into tarikbc:main Sep 11, 2026
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.

2 participants