Skip to content

Commit 6f4742e

Browse files
authored
Fix duplicate experiment row after first experiment creation (#3174)
1 parent 688fb1c commit 6f4742e

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

packages/frontend/projects/upgrade/src/app/core/experiments/store/experiments.reducer.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,9 @@ const reducer = createReducer(
9494
on(experimentsAction.actionUpsertExperiment, experimentsAction.actionGetExperimentById, (state) => ({
9595
...state,
9696
isLoadingExperiment: true,
97-
// if we don't have a totalExperiments count yet (no paginated call with > 1 has occured yet),
98-
// set it to 1 because we are loading at least one experiment so that nav to root page will not show empty template
99-
totalExperiments: state.totalExperiments ? state.totalExperiments : 1,
97+
// If the total count is unknown, assume at least one experiment is loading so the root page skips the empty state.
98+
// Preserve 0 because it means the backend already confirmed an empty list.
99+
totalExperiments: state.totalExperiments ?? 1,
100100
})),
101101
on(experimentsAction.actionGetExperimentByIdSuccess, (state, { experiment }) => {
102102
// Upsert experiment: update if exists, add if not (for direct navigation)

0 commit comments

Comments
 (0)