Eliminate base64 data URL bottlenecks in message passing and IndexedDB reads#33
Draft
Eliminate base64 data URL bottlenecks in message passing and IndexedDB reads#33
Conversation
…B reads Co-authored-by: numbers-official <181934381+numbers-official@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] [Feature] Eliminate base64 data URL bottlenecks in message passing
Eliminate base64 data URL bottlenecks in message passing and IndexedDB reads
Mar 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Full base64 screenshot data (2–10 MB per image) was being serialized through Chrome message channels twice per capture and loaded wholesale on every badge update and upload progress tick, causing excessive memory usage and potential service worker termination.
Changes
IndexedDB: lightweight query methods (
IndexedDBService.ts)getAssetCount()— usesIDBObjectStore.count(), no blob loadinggetAllAssetMetadata()— cursor-based, omits theurifield; exportedAssetMetadata = Omit<Asset, 'uri'>typeWatermark pipeline: IDB handoff instead of message-channel payload (
service-worker.ts,offscreen.ts)Previously, the raw data URL was sent to the offscreen doc and the watermarked URL sent back — 2× full serialization per capture. Now:
ADD_WATERMARKmessage carries onlyassetIdSCREENSHOT_CAPTUREDnotification to popup carries onlyassetIdBadge updates:
getAssetCount()instead ofgetAllAssets()(service-worker.ts)No longer loads all asset blobs on every badge refresh.
Upload progress: targeted state update instead of full IDB reload (
popup.tsx)UPLOAD_PROGRESSwithstatus: 'uploading'now does an in-place React state update on the specific asset. Full IDB reload only on status transitions (uploaded/failed).Environment config:
import.meta.envsupport (environment.ts)VITE_API_URLandVITE_ENABLE_LOGGINGread from Vite env vars..env.development(logging on) and.env.production(logging off) added as committed defaults; override via.env.local.Original prompt
📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.