Skip to content

fix(core): repaint when device pixel ratio changes - #46

Merged
chh-ay merged 1 commit into
0.4.0from
fix/device-pixel-ratio-repaint
Jul 27, 2026
Merged

fix(core): repaint when device pixel ratio changes#46
chh-ay merged 1 commit into
0.4.0from
fix/device-pixel-ratio-repaint

Conversation

@chh-ay

@chh-ay chh-ay commented Jul 27, 2026

Copy link
Copy Markdown
Owner

Problem

A display-density change can leave the host at the same CSS size, so ResizeObserver does not fire and the canvas keeps its old backing scale until another interaction.

Change

  • arm a resolution matchMedia listener at the current DPR
  • re-arm it after each change, refresh the scroll-size limit, invalidate pixels, and schedule one render
  • detach the listener on destroy
  • cover 1→2→1 changes, repeated teardown, main-thread canvas sizing, and Worker viewport DPR messages
  • exercise the same transition in Chromium and Firefox; the @portability test also runs in WebKit in Required CI
  • add the required @sheetwrite/core patch changeset

Verification

  • bun test packages/core/test/device-pixel-ratio.test.ts — 2 pass
  • bun test packages/core/test — 762 pass
  • focused Chromium + Firefox DPR browser test — 2 pass
  • bun run typecheck — pass
  • bun run lint — pass (one existing oversized generated-data warning)
  • GITHUB_BASE_REF=0.4.0 bun run changeset:ci — pass

The broader local browser run passed 173 tests; the unrelated sustained-scroll timing check reported 40 ms against its 35 ms target on both attempts. The full root unit run retained the seven known baseline failures from issue #33 (one stale docs inventory assertion and six stale recorded benchmark toolchain assertions). Required CI is the merge gate.

@vercel

vercel Bot commented Jul 27, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sheetwrite Ready Ready Preview, Comment Jul 27, 2026 5:58am

@chh-ay
chh-ay merged commit dac694a into 0.4.0 Jul 27, 2026
11 checks passed
@chh-ay
chh-ay deleted the fix/device-pixel-ratio-repaint branch July 27, 2026 06:05
@chh-ay chh-ay mentioned this pull request Jul 27, 2026
36 tasks
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