Skip to content

fix(images): keep the pointer cache honest - #33

Merged
skjnldsv merged 1 commit into
mainfrom
fix/image-pointer-handling
Sep 10, 2026
Merged

skjnldsv merged 1 commit into
mainfrom
fix/image-pointer-handling

Conversation

@skjnldsv

Copy link
Copy Markdown
Contributor

An up from a pointer the image never had, one that went down beside it, found an index of -1 in the cache, and splice(-1, 1) reads that as the last entry: a finger still on the screen was dropped and the pinch it was part of ended. Such an event is nothing to this image now.

A pointer the browser takes back, when it turns the gesture into a scroll or into the swipe to the next file, sends no up at all. Nothing listened for pointercancel, so that finger stayed in the cache, leaving the image mid-drag or refusing to swipe until another gesture happened to clear it.

The first load is also a request, for an svg (fetched to be sanitized) or an E2EE file (fetched by hand), and it was started with nobody waiting on it. A rejection there reached the console and nothing else: the element had nothing to show and the viewer waited on its spinner for a loaded event that could never come. It reports errored like any other failure to load.

Three tests, all failing before. jsdom has no PointerEvent and the coordinates of a MouseEvent cannot be set after the fact, so the pointer tests build the events by hand and dispatch them.

Note for whoever merges: the @nextcloud/axios mock this adds to media.spec.ts is the same block #22 adds. Whichever lands second wants one copy of it, not two.

👾 This pull request was assisted by Claude Code, commits carry an Assisted-by trailer.

@skjnldsv skjnldsv added status: review Waiting for reviews type: bug 🐛 Something isn't working AI assisted labels Sep 10, 2026
@codecov

codecov Bot commented Sep 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.84%. Comparing base (d2d8ebf) to head (be6b25d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #33      +/-   ##
==========================================
+ Coverage   84.91%   87.84%   +2.92%     
==========================================
  Files          36       36              
  Lines        2460     2477      +17     
  Branches      501      517      +16     
==========================================
+ Hits         2089     2176      +87     
+ Misses        368      297      -71     
- Partials        3        4       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@skjnldsv
skjnldsv force-pushed the fix/image-pointer-handling branch 2 times, most recently from ce1c608 to d798df4 Compare September 10, 2026 16:25
An `up` from a pointer the image never had, one that went down beside it,
found an index of -1 in the cache, which `splice(-1, 1)` reads as the
last entry: a finger still on the screen was dropped and the pinch it
was part of ended. Such an event is nothing to this image now.

A pointer the browser takes back, when it turns the gesture into a
scroll or the swipe to the next file, sends no `up` at all. Nothing
listened for `pointercancel`, so that finger stayed in the cache and
left the image mid-drag, or refusing to swipe.

The first load is also a request, for an svg or an E2EE file, and it was
started without anyone waiting on it: a rejection there reached the
console and nothing else, leaving the viewer on its spinner. It reports
`errored` like any other failure to load.

Assisted-by: ClaudeCode:claude-opus-5
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
@skjnldsv
skjnldsv force-pushed the fix/image-pointer-handling branch from d798df4 to be6b25d Compare September 10, 2026 17:05
@skjnldsv
skjnldsv merged commit 86c2e02 into main Sep 10, 2026
18 checks passed
@skjnldsv
skjnldsv deleted the fix/image-pointer-handling branch September 10, 2026 18:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted status: review Waiting for reviews type: bug 🐛 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant