firmware/reducers: remove 'flashing' state

The 'flashing' state variable in the firmware reducer is not used
anymore so can be removed.
This commit is contained in:
David Lechner
2026-01-04 17:27:08 -06:00
parent 6911bdd3da
commit 7fe080bf1a
2 changed files with 1 additions and 36 deletions
+1 -20
View File
@@ -2,15 +2,8 @@
// Copyright (c) 2021-2026 The Pybricks Authors
import { AnyAction } from 'redux';
import {
FailToFinishReasonType,
didFailToFinish,
didFinish,
didStart,
} from './actions';
import reducers from './reducers';
type State = ReturnType<typeof reducers>;
import reducers from './reducers';
test('initial state', () => {
expect(reducers(undefined, {} as AnyAction)).toMatchInlineSnapshot(`
@@ -18,7 +11,6 @@ test('initial state', () => {
"dfuWindowsDriverInstallDialog": {
"isOpen": false,
},
"flashing": false,
"installPybricksDialog": {
"isOpen": false,
},
@@ -31,14 +23,3 @@ test('initial state', () => {
}
`);
});
test('flashing', () => {
expect(reducers({ flashing: false } as State, didStart()).flashing).toBe(true);
expect(reducers({ flashing: true } as State, didFinish()).flashing).toBe(false);
expect(
reducers(
{ flashing: true } as State,
didFailToFinish(FailToFinishReasonType.TimedOut),
).flashing,
).toBe(false);
});
-16
View File
@@ -3,9 +3,6 @@
import { Reducer, combineReducers } from 'redux';
import {
didFailToFinish,
didFinish,
didStart,
firmwareDidFailToFlashUsbDfu,
firmwareDidFailToRestoreOfficialDfu,
firmwareDidFailToRestoreOfficialEV3,
@@ -20,18 +17,6 @@ import dfuWindowsDriverInstallDialog from './dfuWindowsDriverInstallDialog/reduc
import installPybricksDialog from './installPybricksDialog/reducers';
import restoreOfficialDialog from './restoreOfficialDialog/reducers';
const flashing: Reducer<boolean> = (state = false, action) => {
if (didStart.matches(action)) {
return true;
}
if (didFinish.matches(action) || didFailToFinish.matches(action)) {
return false;
}
return state;
};
const isFirmwareFlashUsbDfuInProgress: Reducer<boolean> = (state = false, action) => {
if (firmwareFlashUsbDfu.matches(action)) {
return true;
@@ -86,7 +71,6 @@ export default combineReducers({
dfuWindowsDriverInstallDialog,
installPybricksDialog,
restoreOfficialDialog,
flashing,
isFirmwareFlashUsbDfuInProgress,
isFirmwareRestoreOfficialDfuInProgress,
isFirmwareFlashEV3InProgress,