Skip to content

Commit 3289568

Browse files
authored
bug(replay): Do not render the list page until project data has loaded (#44623)
We need to wait for project data so we can know whether to render the empty-state "setup" onboariding page, or if we should load the table and wait for table rows to appear Fixes #44622
1 parent 0fb31f9 commit 3289568

File tree

4 files changed

+26
-16
lines changed

4 files changed

+26
-16
lines changed

static/app/components/events/eventReplay/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Props = {
1515
};
1616

1717
export default function EventReplay({replayId, orgSlug, projectSlug, event}: Props) {
18-
const hasSentOneReplay = useHaveSelectedProjectsSentAnyReplayEvents();
18+
const {hasSentOneReplay} = useHaveSelectedProjectsSentAnyReplayEvents();
1919

2020
const onboardingPanel = useCallback(() => import('./replayInlineOnboardingPanel'), []);
2121
const replayPreview = useCallback(() => import('./replayPreview'), []);

static/app/components/events/interfaces/breadcrumbs/breadcrumbs.spec.tsx

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,11 @@ describe('Breadcrumbs', () => {
5050
>;
5151

5252
beforeEach(() => {
53-
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue(false);
54-
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
53+
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue({
5554
hasSentOneReplay: false,
55+
fetching: false,
56+
});
57+
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
5658
activateSidebar: jest.fn(),
5759
});
5860
props = {
@@ -201,9 +203,11 @@ describe('Breadcrumbs', () => {
201203

202204
describe('replay', () => {
203205
it('should render the replay inline onboarding component when replays are enabled and the project supports replay', async function () {
204-
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue(false);
205-
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
206+
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue({
206207
hasSentOneReplay: false,
208+
fetching: false,
209+
});
210+
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
207211
activateSidebar: jest.fn(),
208212
});
209213
const {container} = render(
@@ -225,9 +229,11 @@ describe('Breadcrumbs', () => {
225229
});
226230

227231
it('should not render the replay inline onboarding component when the project is not JS', async function () {
228-
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue(false);
229-
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
232+
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue({
230233
hasSentOneReplay: false,
234+
fetching: false,
235+
});
236+
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
231237
activateSidebar: jest.fn(),
232238
});
233239
const {container} = render(
@@ -251,9 +257,11 @@ describe('Breadcrumbs', () => {
251257
});
252258

253259
it('should render a replay when there is a replayId', async function () {
254-
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue(true);
255-
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
260+
MockUseHaveSelectedProjectsSentAnyReplayEvents.mockReturnValue({
256261
hasSentOneReplay: true,
262+
fetching: false,
263+
});
264+
MockUseReplayOnboardingSidebarPanel.mockReturnValue({
257265
activateSidebar: jest.fn(),
258266
});
259267
const {container} = render(

static/app/utils/replays/hooks/useReplayOnboarding.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function getSelectedProjectList(
2525
}
2626

2727
export function useHaveSelectedProjectsSentAnyReplayEvents() {
28-
const {projects} = useProjects();
28+
const {projects, fetching} = useProjects();
2929
const {selection} = usePageFilters();
3030

3131
const orgSentOneOrMoreReplayEvent = useMemo(() => {
@@ -34,12 +34,14 @@ export function useHaveSelectedProjectsSentAnyReplayEvents() {
3434
return hasSentOneReplay;
3535
}, [selection.projects, projects]);
3636

37-
return orgSentOneOrMoreReplayEvent;
37+
return {
38+
hasSentOneReplay: orgSentOneOrMoreReplayEvent,
39+
fetching,
40+
};
3841
}
3942

4043
export function useReplayOnboardingSidebarPanel() {
4144
const {location} = useRouteContext();
42-
const hasSentOneReplay = useHaveSelectedProjectsSentAnyReplayEvents();
4345

4446
useEffect(() => {
4547
if (location.hash === '#replay-sidequest') {
@@ -53,5 +55,5 @@ export function useReplayOnboardingSidebarPanel() {
5355
SidebarPanelStore.activatePanel(SidebarPanelKey.ReplaysOnboarding);
5456
}, []);
5557

56-
return {hasSentOneReplay, activateSidebar};
58+
return {activateSidebar};
5759
}

static/app/views/replays/list/replays.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import EventView from 'sentry/utils/discover/eventView';
99
import {decodeScalar} from 'sentry/utils/queryString';
1010
import {DEFAULT_SORT, REPLAY_LIST_FIELDS} from 'sentry/utils/replays/fetchReplayList';
1111
import useReplayList from 'sentry/utils/replays/hooks/useReplayList';
12-
import {useReplayOnboardingSidebarPanel} from 'sentry/utils/replays/hooks/useReplayOnboarding';
12+
import {useHaveSelectedProjectsSentAnyReplayEvents} from 'sentry/utils/replays/hooks/useReplayOnboarding';
1313
import {MutableSearch} from 'sentry/utils/tokenizeSearch';
1414
import {useLocation} from 'sentry/utils/useLocation';
1515
import useMedia from 'sentry/utils/useMedia';
@@ -50,13 +50,13 @@ function ReplaysList() {
5050
organization,
5151
});
5252

53-
const {hasSentOneReplay} = useReplayOnboardingSidebarPanel();
53+
const {hasSentOneReplay, fetching} = useHaveSelectedProjectsSentAnyReplayEvents();
5454

5555
return (
5656
<Layout.Body>
5757
<Layout.Main fullWidth>
5858
<ReplaysFilters />
59-
{hasSentOneReplay ? (
59+
{fetching ? null : hasSentOneReplay ? (
6060
<Fragment>
6161
<ReplayTable
6262
fetchError={fetchError}

0 commit comments

Comments
 (0)