Skip to content

Stabilize profile image object URLs#106

Closed
LiranCohen wants to merge 2 commits into
mainfrom
fix/discovered-identity-profile-sync
Closed

Stabilize profile image object URLs#106
LiranCohen wants to merge 2 commits into
mainfrom
fix/discovered-identity-profile-sync

Conversation

@LiranCohen

Copy link
Copy Markdown
Contributor

Summary

  • cache profile avatar/hero object URLs by record identity so unchanged refetches reuse the same blob URL
  • delay revoking replaced/missing image URLs so React Query background refetches do not break currently rendered <img> sources
  • add profile query tests for unchanged refetches and delayed revocation

Why

After discovered-identity sync started invalidating profile queries correctly, React Query can refetch profile data while the UI is still rendering the previous result. The old fetchProfile() revoked previous object URLs at the start of every refetch, which made the browser try to load revoked blob: URLs and log net::ERR_FILE_NOT_FOUND even though the UI recovered quickly.

Tests

  • bun run test -- src/enbox/queries/__tests__/identity-queries.test.ts src/enbox/__tests__/identity-sync.test.ts src/enbox/hooks/__tests__/use-identity-sync-reconciliation.test.tsx src/enbox/hooks/__tests__/use-sync-query-invalidation.test.tsx
  • bunx tsc -b
  • bun run test
  • bun run lint (passes with existing Testing Library warnings)
  • bun run build (passes with existing chunk-size warnings)

@github-actions

Copy link
Copy Markdown

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 43.81% (🎯 25%) 953 / 2175
🔵 Statements 42.27% (🎯 25%) 1023 / 2420
🔵 Functions 43.9% (🎯 30%) 270 / 615
🔵 Branches 38.89% (🎯 29%) 611 / 1571
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/App.tsx 49.36% 28.2% 52.17% 48% 42-78, 101-103, 133-137, 144, 160, 171, 176-189, 206-214, 216-259
src/enbox/identity-sync.ts 71.18% 60.46% 63.63% 72.41% 24-32, 47, 60, 67-74, 82, 96, 108-115, 132
src/enbox/hooks/use-identity-sync-reconciliation.ts 87.5% 86.66% 100% 86.66% 34-35, 44, 63
src/enbox/hooks/use-sync-query-invalidation.ts 88.23% 83.33% 100% 87.87% 40, 47, 64-65
src/enbox/queries/identity-queries.ts 58.82% 64.51% 47.05% 60.6% 74-78, 103-104, 140, 151-152, 169-246
Generated in workflow #278 for commit 5f73db7 by the Vitest Coverage Report Action

@LiranCohen

Copy link
Copy Markdown
Contributor Author

Closing this in favor of a clean branch based on current main. The replacement PR contains only the profile image object URL fix.

@LiranCohen LiranCohen closed this May 28, 2026
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