-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(replay): Refetch the viewed-by data after an update to it (#69357)
This follows #69232 which removed some optimistic updated that would cause crazy re-rendering. Instead we'll just invalidate (and re-fetch if needed) the `/viewed-by/` endpoint data. This is related to the viewed-by replay project: getsentry/team-replay#19 #64924
- Loading branch information
Showing
7 changed files
with
51 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import AvatarList from 'sentry/components/avatar/avatarList'; | ||
import HeaderPlaceholder from 'sentry/components/replays/header/headerPlaceholder'; | ||
import type {User} from 'sentry/types/user'; | ||
import {useApiQuery} from 'sentry/utils/queryClient'; | ||
import useOrganization from 'sentry/utils/useOrganization'; | ||
import useProjects from 'sentry/utils/useProjects'; | ||
|
||
type TResponseData = { | ||
data: { | ||
viewed_by: User[]; | ||
}; | ||
}; | ||
|
||
interface Props { | ||
projectId: string; | ||
replayId: string; | ||
} | ||
|
||
export default function ReplayViewers({projectId, replayId}: Props) { | ||
const organization = useOrganization(); | ||
|
||
const {projects} = useProjects(); | ||
const project = projects.find(p => p.id === projectId); | ||
const projectSlug = project?.slug; | ||
const url = `/projects/${organization.slug}/${projectSlug}/replays/${replayId}/viewed-by/`; | ||
|
||
const {data, isError, isLoading} = useApiQuery<TResponseData>([url], { | ||
staleTime: 0, | ||
}); | ||
|
||
return isLoading || isError ? ( | ||
<HeaderPlaceholder width="55px" height="27px" /> | ||
) : ( | ||
<AvatarList avatarSize={25} users={data?.data.viewed_by} /> | ||
); | ||
} |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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