[PR #7242] [MERGED] fix(theme): keep the app running when WebKit refuses canvas reads #7641

Closed
opened 2026-10-24 04:06:06 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Pasta-Devs/Marinara-Engine/pull/7242
Author: @SpicyMarinara
Created: 10/7/2026
Status: ✅ Merged
Merged: 10/7/2026
Merged by: @SpicyMarinara

Base: staging ← Head: fix/webkit-backing-canvas-7241


📝 Commits (2)

  • 393d1b3 fix(theme): keep the app running when WebKit refuses canvas reads
  • 66bb8ea test(theme): assert the exact fallback backing colour without canvas reads

📊 Changes

3 files changed (+45 additions, -15 deletions)

View changed files

📝 CHANGELOG.md (+1 -0)
📝 e2e/core-flows.e2e.ts (+23 -0)
📝 packages/client/src/App.tsx (+21 -15)

📄 Description

Important

Contributions target staging. Only SpicyMarinara may promote this repository's staging branch or a same-repository hotfix/* branch to main.
Outside and first-time contributors also require an approving review from SpicyMarinara.

Linked issue

Closes #7241

Why this change

  • Since 2026-10-03, the app paints theme colours onto a 1×1 canvas to work out an opaque colour for the iPhone safe area, overscroll and browser bar. WebKit can refuse to read that canvas back when memory is low (InvalidStateError, "Unable to get image data from canvas"). The error was thrown inside a React effect, so the whole app fell into Marinara hit a recoverable UI error. over a cosmetic colour. The #7236 verifier found it: it caused the mobile-webkit "blank app page" failures under parallel test load, and iOS Safari users under memory pressure can hit the same thing.

What changed

  • packages/client/src/App.tsx: the canvas reads in syncLiteralBackground are wrapped in try/catch. If the browser refuses, the page backing and the browser bar keep the theme's unflattened background colour. The rest of the shell keeps running, and the browser console gets a warning.
  • e2e/core-flows.e2e.ts: a new test makes getImageData throw InvalidStateError and checks that the app shell loads without the recovery screen and still sets a backing colour.
  • CHANGELOG.md: user-facing entry.

Validation

  • pnpm check passes locally
  • Container (Docker / Podman) built and ran without issue
  • Ran the app, clicked through the changes manually
  • Checked edge cases (light + dark mode, mobile viewport, empty states, error paths)
  • Above manual verification completed (describe below)
  • Read and followed CONTRIBUTING.md

Agent-run checks (for the reviewer to confirm, not ticked):

  • pnpm check: exit 0.
  • Without the App.tsx change, the new test fails on desktop-chromium: the page shows the "Marinara hit a recoverable UI error." heading and no app shell.
  • With the change, the new test passes on desktop-chromium and mobile-webkit. The existing mobile backing/keyboard viewport test also passes on mobile-webkit, so the normal flattening is unchanged.

Manual verification notes

  • Manually verify on an iPhone (or Safari's responsive mode) that the safe-area and overscroll colour still match the top bar in light and dark mode and with a custom background colour.
  • Manually verify the app still opens normally in Safari after switching visual themes a few times.

Docs and release impact

  • No docs changes needed
  • Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed
  • Translated docs on the docs-i18n branch updated to match, or a [docs-i18n] follow-up issue opened (see CONTRIBUTING.md § Translated documentation)
  • Version/release files updated (only if this PR includes a version bump)

Only CHANGELOG.md changes. No guide under docs/ describes this.

UI evidence (if applicable)

No visual change when the browser allows the canvas read.

Summary by CodeRabbit

  • Bug Fixes
    • Safari and other WebKit browsers now retain the page background and browser bar theme color if canvas color reading fails, instead of showing a recoverable error.
    • The app shell remains visible when this canvas error occurs.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Pasta-Devs/Marinara-Engine/pull/7242 **Author:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Created:** 10/7/2026 **Status:** ✅ Merged **Merged:** 10/7/2026 **Merged by:** [@SpicyMarinara](https://github.com/SpicyMarinara) **Base:** `staging` ← **Head:** `fix/webkit-backing-canvas-7241` --- ### 📝 Commits (2) - [`393d1b3`](https://github.com/Pasta-Devs/Marinara-Engine/commit/393d1b335936ec9acc30fea35010b9c02091370d) fix(theme): keep the app running when WebKit refuses canvas reads - [`66bb8ea`](https://github.com/Pasta-Devs/Marinara-Engine/commit/66bb8eac843975706bcac7b11a636a121b4d782c) test(theme): assert the exact fallback backing colour without canvas reads ### 📊 Changes **3 files changed** (+45 additions, -15 deletions) <details> <summary>View changed files</summary> 📝 `CHANGELOG.md` (+1 -0) 📝 `e2e/core-flows.e2e.ts` (+23 -0) 📝 `packages/client/src/App.tsx` (+21 -15) </details> ### 📄 Description > [!IMPORTANT] > Contributions target `staging`. Only `SpicyMarinara` may promote this repository's `staging` branch or a same-repository `hotfix/*` branch to `main`. > Outside and first-time contributors also require an approving review from `SpicyMarinara`. ## Linked issue Closes #7241 ## Why this change - Since 2026-10-03, the app paints theme colours onto a 1×1 canvas to work out an opaque colour for the iPhone safe area, overscroll and browser bar. WebKit can refuse to read that canvas back when memory is low (`InvalidStateError`, "Unable to get image data from canvas"). The error was thrown inside a React effect, so the whole app fell into **Marinara hit a recoverable UI error.** over a cosmetic colour. The #7236 verifier found it: it caused the mobile-webkit "blank app page" failures under parallel test load, and iOS Safari users under memory pressure can hit the same thing. ## What changed - `packages/client/src/App.tsx`: the canvas reads in `syncLiteralBackground` are wrapped in `try/catch`. If the browser refuses, the page backing and the browser bar keep the theme's unflattened background colour. The rest of the shell keeps running, and the browser console gets a warning. - `e2e/core-flows.e2e.ts`: a new test makes `getImageData` throw `InvalidStateError` and checks that the app shell loads without the recovery screen and still sets a backing colour. - `CHANGELOG.md`: user-facing entry. ## Validation - [ ] `pnpm check` passes locally - [ ] Container (Docker / Podman) built and ran without issue - [ ] Ran the app, clicked through the changes manually - [ ] Checked edge cases (light + dark mode, mobile viewport, empty states, error paths) - [ ] Above manual verification completed (describe below) - [ ] Read and followed `CONTRIBUTING.md` Agent-run checks (for the reviewer to confirm, not ticked): - `pnpm check`: exit 0. - Without the `App.tsx` change, the new test fails on desktop-chromium: the page shows the "Marinara hit a recoverable UI error." heading and no app shell. - With the change, the new test passes on desktop-chromium and mobile-webkit. The existing mobile backing/keyboard viewport test also passes on mobile-webkit, so the normal flattening is unchanged. ### Manual verification notes - Manually verify on an iPhone (or Safari's responsive mode) that the safe-area and overscroll colour still match the top bar in light and dark mode and with a custom background colour. - Manually verify the app still opens normally in Safari after switching visual themes a few times. ## Docs and release impact - [ ] No docs changes needed - [ ] Updated docs (README / CONTRIBUTING / android/README / CHANGELOG) as needed - [ ] Translated docs on the `docs-i18n` branch updated to match, or a `[docs-i18n]` follow-up issue opened (see CONTRIBUTING.md § Translated documentation) - [ ] Version/release files updated (only if this PR includes a version bump) Only `CHANGELOG.md` changes. No guide under `docs/` describes this. ## UI evidence (if applicable) No visual change when the browser allows the canvas read. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Safari and other WebKit browsers now retain the page background and browser bar theme color if canvas color reading fails, instead of showing a recoverable error. * The app shell remains visible when this canvas error occurs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-24 04:06:06 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Pasta-Devs/Marinara-Engine#7641
No description provided.