Skip to content

fix(reports): keep branding logo preview offline - #374

Open
luandro wants to merge 2 commits into
mainfrom
fix/report-branding-webkit
Open

luandro wants to merge 2 commits into
mainfrom
fix/report-branding-webkit

Conversation

@luandro

@luandro luandro commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • render report-branding logo previews from validated local bytes via a browser-local blob URL
  • clean up object URLs on replacement/removal/unmount via the React callback-ref lifecycle
  • add regression coverage for object-URL preview creation and cleanup

Why

Post-merge main CI exposed a pre-existing WebKit-only failure in the offline mobile report-branding flow: the state advanced to Report logo configured, but the preview image backed by a data: URL was not visible while WebKit network emulation was offline. The identical failure is present on the preceding main commit, so this is a focused baseline repair rather than a regression from #345.

Validation

  • focused branding/Home/i18n unit suite: 112/112 pass
  • ESLint: pass
  • TypeScript: pass
  • Prettier: pass
  • production build + security verifier: pass
  • Chromium report-branding E2E: 2/2 pass, retries disabled
  • Firefox report-branding E2E: 2/2 pass, retries disabled
  • local WebKit: NOT RUN — environment unavailable (missing GTK/GStreamer/WebKit host libraries); exact-SHA GitHub CI is the required WebKit oracle

QA: docs/qa/270-report-branding.md

Merge authorization is not implied by this follow-up PR.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 1 new issue in 1 file · 1 warning · score 92 / 100 (Great) · 0 fixed · vs main

1 warning

src/screens/Home/ReportBrandingDialog.tsx

  • ⚠️ L50 createObjectURL without revokeObjectURL no-create-object-url-without-revoke

Reviewed by React Doctor for commit 329ca46. See inline comments for fixes.

@github-actions

github-actions Bot commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Preview deployment ready: https://fix-report-branding-webkit.comapeo-cloud-app.pages.dev

Commit: d6ddb09


return `data:${logo.contentType};base64,${globalThis.btoa(binary)}`;
function createLogoPreviewUrl(logo: ReportBrandingLogoAsset): string {
return URL.createObjectURL(new Blob([logo.data], { type: logo.contentType }));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-create-object-url-without-revoke (warning)

URL.createObjectURL(...) pins the underlying Blob/File in memory, and this produced URL is not provably revoked. Store the URL and pass that same value to URL.revokeObjectURL once you're done so the Blob can be freed.

Fix → Call URL.revokeObjectURL(url) once the object URL is no longer needed (after the download, in a useEffect cleanup, or on unmount). An object URL keeps its Blob/File alive for the document lifetime until it is revoked.

Docs

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