Skip to content

Commit ad31226

Browse files
Revert "feat(replay): Persist has-viewed state to the server when replays are seen (#68743)"
This reverts commit b0a33ce. Co-authored-by: ryan953 <[email protected]>
1 parent 21c49d4 commit ad31226

File tree

4 files changed

+10
-97
lines changed

4 files changed

+10
-97
lines changed

Diff for: static/app/components/events/eventReplay/replayPreviewPlayer.tsx

+2-10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ComponentProps} from 'react';
2-
import {useEffect, useRef, useState} from 'react';
2+
import {useRef, useState} from 'react';
33
import styled from '@emotion/styled';
44

55
import {Button, LinkButton} from 'sentry/components/button';
@@ -18,7 +18,6 @@ import {space} from 'sentry/styles/space';
1818
import EventView from 'sentry/utils/discover/eventView';
1919
import getRouteStringFromRoutes from 'sentry/utils/getRouteStringFromRoutes';
2020
import {TabKey} from 'sentry/utils/replays/hooks/useActiveReplayTab';
21-
import useMarkReplayViewed from 'sentry/utils/replays/hooks/useMarkReplayViewed';
2221
import {useLocation} from 'sentry/utils/useLocation';
2322
import useOrganization from 'sentry/utils/useOrganization';
2423
import {useRoutes} from 'sentry/utils/useRoutes';
@@ -54,7 +53,7 @@ function ReplayPreviewPlayer({
5453
const location = useLocation();
5554
const organization = useOrganization();
5655
const [isSidebarOpen, setIsSidebarOpen] = useState(true);
57-
const {replay, currentTime, isFetching, isFinished, isPlaying} = useReplayContext();
56+
const {replay, currentTime, isFinished, isPlaying} = useReplayContext();
5857
const eventView = EventView.fromLocation(location);
5958

6059
const fullscreenRef = useRef(null);
@@ -77,13 +76,6 @@ function ReplayPreviewPlayer({
7776
},
7877
};
7978

80-
const {mutate: markAsViewed} = useMarkReplayViewed();
81-
useEffect(() => {
82-
if (replayRecord && !replayRecord.has_viewed && !isFetching && isPlaying) {
83-
markAsViewed({projectSlug: replayRecord.project_id, replayId: replayRecord.id});
84-
}
85-
}, [isFetching, isPlaying, markAsViewed, replayRecord]);
86-
8779
return (
8880
<PlayerPanel>
8981
<HeaderWrapper>

Diff for: static/app/utils/replays/hooks/useMarkReplayViewed.tsx

-59
This file was deleted.

Diff for: static/app/views/issueDetails/groupReplays/groupReplays.spec.tsx

+7-13
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ const mockEventTimestampMs = mockEventTimestamp.getTime();
5555
// Get replay data with the mocked replay reader params
5656
const mockReplay = ReplayReader.factory({
5757
replayRecord: ReplayRecordFixture({
58-
id: REPLAY_ID_1,
5958
browser: {
6059
name: 'Chrome',
6160
version: '110.0.0',
@@ -84,7 +83,7 @@ mockUseReplayReader.mockImplementation(() => {
8483
projectSlug: ProjectFixture().slug,
8584
replay: mockReplay,
8685
replayId: REPLAY_ID_1,
87-
replayRecord: ReplayRecordFixture({id: REPLAY_ID_1}),
86+
replayRecord: ReplayRecordFixture(),
8887
};
8988
});
9089

@@ -371,7 +370,7 @@ describe('GroupReplays', () => {
371370
count_errors: 1,
372371
duration: 52346,
373372
finished_at: new Date('2022-09-15T06:54:00+00:00'),
374-
id: REPLAY_ID_1,
373+
id: '346789a703f6454384f1de473b8b9fcc',
375374
started_at: new Date('2022-09-15T06:50:00+00:00'),
376375
urls: [
377376
'https://dev.getsentry.net:7999/replays/',
@@ -383,7 +382,7 @@ describe('GroupReplays', () => {
383382
count_errors: 4,
384383
duration: 400,
385384
finished_at: new Date('2022-09-21T21:40:38+00:00'),
386-
id: REPLAY_ID_2,
385+
id: 'b05dae9b6be54d21a4d5ad9f8f02b780',
387386
started_at: new Date('2022-09-21T21:30:44+00:00'),
388387
urls: [
389388
'https://dev.getsentry.net:7999/organizations/org-slug/replays/?project=2&statsPeriod=24h',
@@ -476,7 +475,7 @@ describe('GroupReplays', () => {
476475
count_errors: 1,
477476
duration: 52346,
478477
finished_at: new Date('2022-09-15T06:54:00+00:00'),
479-
id: REPLAY_ID_1,
478+
id: '346789a703f6454384f1de473b8b9fcc',
480479
started_at: new Date('2022-09-15T06:50:00+00:00'),
481480
urls: [
482481
'https://dev.getsentry.net:7999/replays/',
@@ -488,7 +487,7 @@ describe('GroupReplays', () => {
488487
count_errors: 4,
489488
duration: 400,
490489
finished_at: new Date('2022-09-21T21:40:38+00:00'),
491-
id: REPLAY_ID_2,
490+
id: 'b05dae9b6be54d21a4d5ad9f8f02b780',
492491
started_at: new Date('2022-09-21T21:30:44+00:00'),
493492
urls: [
494493
'https://dev.getsentry.net:7999/organizations/org-slug/replays/?project=2&statsPeriod=24h',
@@ -532,7 +531,6 @@ describe('GroupReplays', () => {
532531
organizationProps: {features: ['session-replay']},
533532
}));
534533
const mockGroup = GroupFixture();
535-
const mockReplayRecord = mockReplay?.getReplay();
536534

537535
const mockReplayCountApi = MockApiClient.addMockResponse({
538536
url: mockReplayCountUrl,
@@ -550,7 +548,7 @@ describe('GroupReplays', () => {
550548
count_errors: 1,
551549
duration: 52346,
552550
finished_at: new Date('2022-09-15T06:54:00+00:00'),
553-
id: REPLAY_ID_1,
551+
id: '346789a703f6454384f1de473b8b9fcc',
554552
started_at: new Date('2022-09-15T06:50:00+00:00'),
555553
urls: [
556554
'https://dev.getsentry.net:7999/replays/',
@@ -562,7 +560,7 @@ describe('GroupReplays', () => {
562560
count_errors: 4,
563561
duration: 400,
564562
finished_at: new Date('2022-09-21T21:40:38+00:00'),
565-
id: REPLAY_ID_2,
563+
id: 'b05dae9b6be54d21a4d5ad9f8f02b780',
566564
started_at: new Date('2022-09-21T21:30:44+00:00'),
567565
urls: [
568566
'https://dev.getsentry.net:7999/organizations/org-slug/replays/?project=2&statsPeriod=24h',
@@ -577,10 +575,6 @@ describe('GroupReplays', () => {
577575
})),
578576
},
579577
});
580-
MockApiClient.addMockResponse({
581-
method: 'POST',
582-
url: `/projects/${organization.slug}/${mockReplayRecord?.project_id}/replays/${mockReplayRecord?.id}/viewed-by/`,
583-
});
584578

585579
render(<GroupReplays group={mockGroup} />, {
586580
context: routerContext,

Diff for: static/app/views/replays/details.tsx

+1-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, useEffect} from 'react';
1+
import {Fragment} from 'react';
22
import type {RouteComponentProps} from 'react-router';
33

44
import Alert from 'sentry/components/alert';
@@ -17,7 +17,6 @@ import {decodeScalar} from 'sentry/utils/queryString';
1717
import type {TimeOffsetLocationQueryParams} from 'sentry/utils/replays/hooks/useInitialTimeOffsetMs';
1818
import useInitialTimeOffsetMs from 'sentry/utils/replays/hooks/useInitialTimeOffsetMs';
1919
import useLogReplayDataLoaded from 'sentry/utils/replays/hooks/useLogReplayDataLoaded';
20-
import useMarkReplayViewed from 'sentry/utils/replays/hooks/useMarkReplayViewed';
2120
import useReplayPageview from 'sentry/utils/replays/hooks/useReplayPageview';
2221
import useReplayReader from 'sentry/utils/replays/hooks/useReplayReader';
2322
import useRouteAnalyticsEventNames from 'sentry/utils/routeAnalytics/useRouteAnalyticsEventNames';
@@ -72,19 +71,6 @@ function ReplayDetails({params: {replaySlug}}: Props) {
7271

7372
useLogReplayDataLoaded({fetchError, fetching, projectSlug, replay});
7473

75-
const {mutate: markAsViewed} = useMarkReplayViewed();
76-
useEffect(() => {
77-
if (
78-
!fetchError &&
79-
replayRecord &&
80-
!replayRecord.has_viewed &&
81-
projectSlug &&
82-
!fetching
83-
) {
84-
markAsViewed({projectSlug, replayId});
85-
}
86-
}, [fetchError, fetching, markAsViewed, projectSlug, replayId, replayRecord]);
87-
8874
const initialTimeOffsetMs = useInitialTimeOffsetMs({
8975
orgSlug,
9076
projectSlug,

0 commit comments

Comments
 (0)