feat: implement blob caching for cutout images#10
Conversation
- add blob caching to avoid re-fetching images - add utility function to revoke blob URLs - clean up blob URLs when components unmount or data changes - fallback to direct URL if fetch fails - bypass zrok interstitial by adding headers
|
Caution Review failedThe pull request is closed. WalkthroughAdds blob URL caching for cutout images in the API, exposes a revoke function, and integrates cleanup in CutoutGrid and Gallery to revoke blob URLs on change/unmount. Extends error handling for ngrok/zrok bypass. Development proxy behavior remains unchanged. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as UI Component (CutoutGrid/Gallery)
participant A as API.getCutoutObject
participant C as Blob Cache (Map)
participant B as Browser
U->>A: request cutout URL
A->>C: check cache by key
alt cache hit
C-->>A: blob: URL
A-->>U: blob: URL
else cache miss
A->>B: fetch(image URL with bypass headers)
alt fetch ok
B-->>A: Response
A->>B: createObjectURL(blob)
B-->>A: blob: URL
A->>C: cache(key, blob: URL)
A-->>U: blob: URL
else fetch fails
A-->>U: direct image URL (fallback)
end
end
note over U,B: On unmount or data change
U->>A: revokeBlobUrl(blob: URL)
A->>C: remove cache entry for URL
A->>B: URL.revokeObjectURL(blob: URL)
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs. 📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary by CodeRabbit
New Features
Bug Fixes