fix(dashboards): Use avatarType from API to render correct avatar in revision list#114336
Merged
fix(dashboards): Use avatarType from API to render correct avatar in revision list#114336
Conversation
…revision list The avatar was hardcoded to 'upload' type for any non-null avatarUrl, causing gravatar users to have their avatar URL treated as an upload URL. Now avatarType is passed through from the API response and used to construct the avatar object correctly, so gravatar, upload, and letter avatars all render as intended. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…item The current version item was passing a User object directly as createdBy, but User has avatar fields nested under avatar.avatarType rather than at the top level. Map to the expected shape so the avatar renders correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Verify that passing avatarType: 'gravatar' renders a gravatar-avatar container, confirming the correct avatar rendering path is used. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The CAROL fixture was missing avatarType after the prop shape changed from avatarUrl-based to avatarType-based avatar rendering. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace inline object type with a named Pick<AvatarUser, ...> type in useDashboardRevisions.tsx, and use Avatar['avatarType'] for precise avatarType typing. Update revisionListItem.tsx to reference the shared RevisionCreatedBy type instead of repeating the inline shape. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
DominikB2014
approved these changes
Apr 29, 2026
Contributor
DominikB2014
left a comment
There was a problem hiding this comment.
lgtm, one thing i did notice is AvatarUser has `avatarUrl in it, is it possible to use it from there too?
TypeScript widens string literals in const object declarations, making 'upload' typed as string instead of Avatar['avatarType']. Add as const to preserve the literal type. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
AvatarUser already carries avatarUrl, so include it in the Pick instead of declaring a separate field. Convert Avatar.avatarUrl (string | null) to undefined at the call site so it matches AvatarUser's avatarUrl type. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
AvatarUser.avatarUrl is string | undefined (not null), so omit the field rather than passing null to satisfy the Pick-based type. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
Add an isUser type guard (discriminated by ip_address, which exists on AvatarUser but not RevisionCreatedBy's Pick) so the component handles both shapes. Pass a User directly to UserAvatar; construct the adapter object only for the flat RevisionCreatedBy API shape. This lets dashboardRevisions.tsx pass dashboardCreatedBy directly instead of manually remapping to the flat shape. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
…sions Transform the flat avatarType/avatarUrl fields from the revisions API into a nested avatar object in the hook. RevisionCreatedBy is now Pick<AvatarUser, 'id' | 'name' | 'email' | 'avatar' | 'avatarUrl'>, so User is structurally assignable and dashboardRevisions.tsx can pass dashboardCreatedBy directly without any mapping. The component no longer needs to handle two different createdBy shapes. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
Omit<RawDashboardRevision, 'createdBy'> was unnecessary indirection since both types are local. Write DashboardRevision out directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
…f spreading Spreading ...raw included the raw createdBy only to immediately override it. List fields explicitly. Co-Authored-By: Claude Sonnet 4.6 <noreply@example.com>
knip flagged it as an unused export since no file imports it directly. Callers use DashboardRevision['createdBy'] instead. Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
Contributor
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d2ecbf0. Configure here.
…visions data?.map(normalizeRevision) in the return statement created a new array on every render, breaking React Query's referential stability. Wrapping in useMemo keyed on data restores stable references so RevisionListItem children don't re-render unnecessarily when unrelated state changes. Co-Authored-By: Claude Sonnet 4 <noreply@example.com>
3 tasks
cleptric
pushed a commit
that referenced
this pull request
May 5, 2026
…revision list (#114336) After #114186, we have the avatar type being returned in the revision list endpoint. We should pass that into the avatar component so that it properly shows initials vs upload vs gravatar. The current-version row in the modal passes a full `User` object whose avatar info is nested under `avatar.avatarType`. That field is now explicitly mapped to the flat `createdBy` prop shape so it follows the same rendering path as historical revision rows. --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: Claude Sonnet 4.6 <noreply@example.com>
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.

After #114186, we have the avatar type being returned in the revision list endpoint.
We should pass that into the avatar component so that it properly shows initials vs upload vs gravatar.
The current-version row in the modal passes a full
Userobject whose avatar info is nested underavatar.avatarType. That field is now explicitly mapped to the flatcreatedByprop shape so it follows the same rendering path as historical revision rows.