Skip to content

Commit 90aa74b

Browse files
committed
Address PR comments
1 parent 619bced commit 90aa74b

2 files changed

Lines changed: 6 additions & 12 deletions

File tree

src/redux/skybrowser/skybrowserMiddleware.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const setupSubscription = createAsyncThunk(
3434
const batcher = new Batcher<SkyBrowserUpdate>(updateData);
3535

3636
(async () => {
37-
for await (const data of skybrowserTopic.iterator() as AsyncGenerator<SkyBrowserUpdate>) {
37+
for await (const data of skybrowserTopic.iterator() as AsyncIterable<SkyBrowserUpdate>) {
3838
batcher.add(data);
3939
}
4040
})();
@@ -47,7 +47,7 @@ function tearDownSubscription() {
4747
return;
4848
}
4949
skybrowserTopic.talk({
50-
event: 'stop_supscription'
50+
event: 'stop_subscription'
5151
});
5252
skybrowserTopic.cancel();
5353
}

src/redux/skybrowser/skybrowserSlice.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -58,16 +58,10 @@ export const skyBrowserSlice = createSlice({
5858
typeof idx === 'string' ? parseInt(idx) : idx
5959
);
6060
}
61-
if (action.payload.browsers !== undefined) {
62-
// Derived state for easier access
63-
state.browserIds = Object.keys(action.payload.browsers) ?? [];
64-
state.browserColors = state.browserIds.map(
65-
(id) => action.payload.browsers?.[id].color ?? [255, 255, 255]
66-
);
67-
state.browserNames = state.browserIds.map(
68-
(id) => action.payload.browsers?.[id].name ?? 'Unnamed Browser'
69-
);
70-
}
61+
// Derived state for easier access
62+
state.browserIds = Object.keys(state.browsers);
63+
state.browserColors = state.browserIds.map((id) => state.browsers[id].color);
64+
state.browserNames = state.browserIds.map((id) => state.browsers[id].name);
7165
} else {
7266
// If the update is invalid, reset the state
7367
state.selectedBrowserId = '';

0 commit comments

Comments
 (0)