Skip to content

Commit a8498f8

Browse files
authored
fix: add a loading check prior to setting the buckets (#5716)
1 parent 0e51554 commit a8498f8

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/shared/contexts/buckets.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -91,16 +91,18 @@ export const BucketProvider: FC<Props> = ({
9191

9292
// keep the redux store in sync
9393
useEffect(() => {
94-
dispatch(
95-
setBuckets(
96-
RemoteDataState.Done,
97-
normalize<Bucket, BucketEntities, string[]>(
98-
buckets.filter(b => b.type !== 'sample'),
99-
arrayOfBuckets
94+
if (loading === RemoteDataState.Done) {
95+
dispatch(
96+
setBuckets(
97+
RemoteDataState.Done,
98+
normalize<Bucket, BucketEntities, string[]>(
99+
buckets.filter(b => b.type !== 'sample'),
100+
arrayOfBuckets
101+
)
100102
)
101103
)
102-
)
103-
}, [buckets])
104+
}
105+
}, [buckets, loading])
104106

105107
// TODO: load bucket creation limits on org change
106108
// expose limits to frontend

0 commit comments

Comments
 (0)