Skip to content

fix(dashboard): render Unsplash profile photos and recover avatar after load errors - #1105

Merged
izadoesdev merged 8 commits into
databuddy-analytics:stagingfrom
ANSHSINGH050404:fix/profile-photo-unsplash-csp
Oct 17, 2026
Merged

izadoesdev merged 8 commits into
databuddy-analytics:stagingfrom
ANSHSINGH050404:fix/profile-photo-unsplash-csp

Conversation

@ANSHSINGH050404

@ANSHSINGH050404 ANSHSINGH050404 commented Oct 9, 2026 •

Copy link
Copy Markdown

Fixes #1104. Scope: pasting an \images.unsplash.com\ URL at /settings/account\ saved successfully but the avatar stayed on initials with no preview. Root cause: (1) CSP \img-src\ in \�pps/dashboard/next.config.ts\ omitted the host, so browsers blocked the image; (2) \Avatar\ never reset its \ ailed\ flag on \src\ change, sticking on fallback until remount. Change (1 commit, 2 files): allowlist \https://images.unsplash.com\ in both CSP directive lists; reset \ ailed\ via \useEffect\ on \src. Verification:
ext-config.test.ts\ 12 pass; \ sc --noEmit\ clean in \packages/ui\ and repo-wide (37/37 turbo tasks); ultracite + policy-lint + commit-format hooks green. Note: local pre-push \�un run test\ is red on 4 pre-existing \�pps/links\ shutdown tests that \Bun.spawn(process.execPath)\ with a space in this Windows username (\C:\Users\ANSH SINGH\...) — environmental, unrelated to this diff; pushed with --no-verify, CI is the gate. AI disclosure: diagnosed and implemented with AI assistance (Muse Spark via OpenCode); human-verified via the checks above.


Summary by cubic

Fixes the settings avatar sticking on the initials fallback when the profile photo is blocked or fails to load.

Profile photos can now be pasted from any https origin, and the avatar recovers its preview automatically when the source changes or a previously failed URL is retried.

Changes

  • Broadened the dashboard CSP img-src to allow any https origin instead of allowlisting individual hosts.
  • Avatar now derives its fallback from the normalized src that failed, so a changed or retried src clears the failure and reloads the image.
  • Added an e2e test covering preview recovery, retried loads, and failing sources at /settings/account.

Written for commit a336dc4. Summary will update on new commits.

View guided diff

@vercel

vercel Bot commented Oct 9, 2026

Copy link
Copy Markdown

@ANSHSINGH050404 is attempting to deploy a commit to the Databuddy OSS Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 188be848-06ac-45f1-a6db-3817449ac1ca

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ANSHSINGH050404
ANSHSINGH050404 marked this pull request as ready for review October 9, 2026 11:33
@greptile-apps

greptile-apps Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with a non-blocking photo retry issue.

Findings

  1. P2 Retrying a photo stays blocked ▶

Summary

Allows Unsplash profile photos and restores the avatar preview when the user enters a different URL.

  • Unsplash photos load, and changed avatar URLs recover from failures.

Both previous threads are addressed: the effect is removed, and the requested recovery test is present. Neither thread supplied a comment number.

Reviews (2) · Last reviewed commit: "test(dashboard): cover avatar preview re..." · Reviewed by Greptile

Comment thread packages/ui/src/components/avatar.tsx Outdated
Comment thread packages/ui/src/components/avatar.tsx Outdated
@ANSHSINGH050404

Copy link
Copy Markdown
Author

@greptile-apps check

Comment thread packages/ui/src/components/avatar.tsx Outdated
@ANSHSINGH050404
ANSHSINGH050404 force-pushed the fix/profile-photo-unsplash-csp branch from 623c614 to 67b50ee Compare October 9, 2026 17:05
@izadoesdev
izadoesdev force-pushed the fix/profile-photo-unsplash-csp branch from 67b50ee to a336dc4 Compare October 17, 2026 17:49
@izadoesdev
izadoesdev merged commit 218ca9c into databuddy-analytics:staging Oct 17, 2026
18 of 22 checks passed
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.

2 participants