Skip to content

Commit c464f4f

Browse files
Copilotfitzergerald
andcommitted
Address code review feedback
Co-authored-by: fitzergerald <182300328+fitzergerald@users.noreply.github.com>
1 parent 5cf74d4 commit c464f4f

2 files changed

Lines changed: 14 additions & 11 deletions

File tree

src/custom/ResourceDetailFormatters/Formatter.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ export const MemoryUsage: React.FC<MemoryUsageProps> = ({
423423

424424
const renderResourceProgress = useCallback(
425425
(title: string, percentage: number, type: string) => (
426-
<ResourceProgressContainer key={type}>
426+
<ResourceProgressContainer>
427427
<Typography variant="body1">{title}</Typography>
428428
<BBChart options={chartOptions(percentage, type)} />
429429
</ResourceProgressContainer>

src/redux-persist/PersistedStateProvider.tsx

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@ export const PersistedStateProvider: FC<PersistedStateProviderProps> = ({
2424
return;
2525
}
2626

27-
const loadState = async () => {
28-
try {
29-
dispatch(loadPersistedState());
30-
setLoading(false);
31-
} catch (e) {
32-
setError(e as Error);
33-
setLoading(false);
34-
}
35-
};
27+
let error: Error | null = null;
28+
try {
29+
dispatch(loadPersistedState());
30+
} catch (e) {
31+
error = e as Error;
32+
}
3633

37-
loadState();
34+
// Use queueMicrotask to defer state updates and avoid cascading renders
35+
queueMicrotask(() => {
36+
setLoading(false);
37+
if (error) {
38+
setError(error);
39+
}
40+
});
3841
}, [loading, dispatch, loadPersistedState]);
3942

4043
if (error) {

0 commit comments

Comments
 (0)