Skip to content

Commit bb6fabb

Browse files
committed
storage: avoid rendering wizard pages while Cockpit Storage is active
Rendering wizard pages in the background can trigger API calls to devices that may no longer exist, leading to errors. We currently work around this by handling and silencing these errors [1] as a hotfix for Fedora 42, due to limited time to implement a proper fix. This change takes first steps to a more robust approach by preventing the rendering of wizard pages entirely while cockpit-storage mode is active, avoiding invalid device accesses altogether. [1] 53f2ff
1 parent ab850cc commit bb6fabb

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/components/AnacondaPage.jsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export const AnacondaPage = ({
2727
children,
2828
isFirstScreen,
2929
isFormDisabled,
30+
showStorage,
3031
setIsFormDisabled,
3132
step,
3233
title,
@@ -53,7 +54,9 @@ export const AnacondaPage = ({
5354
}
5455
}, [isFormDisabled]);
5556

56-
if (!showPage) {
57+
// Don't try to render anything while cockpit storage mode is active
58+
// as background API calls might cause UnknownDeviceError
59+
if (!showPage || showStorage) {
5760
return null;
5861
}
5962

src/components/AnacondaWizard.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export const AnacondaWizard = ({ currentStepId, dispatch, isFetching, onCritFail
5151
onCritFail,
5252
setIsFormDisabled,
5353
setIsFormValid,
54-
showStorage,
5554
};
5655

5756
const stepsOrder = getSteps(userInterfaceConfig, isBootIso, storageScenarioId);
@@ -88,6 +87,7 @@ export const AnacondaWizard = ({ currentStepId, dispatch, isFetching, onCritFail
8887
step={s.id}
8988
title={s.title}
9089
isFirstScreen={s.isFirstScreen}
90+
showStorage={showStorage}
9191
usePageInit={s.usePageInit}>
9292
<s.component {...componentProps} isFirstScreen={s.isFirstScreen} />
9393
</AnacondaPage>

src/components/storage/InstallationMethod.jsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,6 @@ const InstallationMethod = ({
5757
setIsFormDisabled,
5858
setIsFormValid,
5959
setStepNotification,
60-
showStorage,
6160
}) => {
6261
const [isReclaimSpaceCheckboxChecked, setIsReclaimSpaceCheckboxChecked] = useState();
6362

@@ -95,7 +94,6 @@ const InstallationMethod = ({
9594
isFormDisabled={isFormDisabled}
9695
onCritFail={onCritFail}
9796
setIsFormValid={setIsFormValid}
98-
showStorage={showStorage}
9997
/>
10098
</DialogsContext.Provider>
10199
</Form>

src/components/storage/InstallationScenario.jsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ const InstallationScenarioSelector = ({
7171
idPrefix,
7272
isFormDisabled,
7373
setIsFormValid,
74-
showStorage,
7574
}) => {
7675
const { appliedPartitioning, diskSelection, partitioning } = useContext(StorageContext);
7776
const { devices, mountPoints } = useOriginalDeviceTree();
@@ -131,11 +130,6 @@ const InstallationScenarioSelector = ({
131130
useEffect(() => {
132131
let selectedScenarioId = "";
133132

134-
// Don't mess up with the scenarios while cockpit storage mode is active
135-
if (showStorage) {
136-
return;
137-
}
138-
139133
if (storageScenarioId && scenarioAvailability[storageScenarioId].available === undefined) {
140134
return;
141135
}
@@ -160,7 +154,7 @@ const InstallationScenarioSelector = ({
160154
dispatch(setStorageScenarioAction(selectedScenarioId));
161155
}
162156
setIsFormValid(!!selectedScenarioId);
163-
}, [dispatch, mountPoints, scenarioAvailability, setIsFormValid, showStorage, storageScenarioId]);
157+
}, [dispatch, mountPoints, scenarioAvailability, setIsFormValid, storageScenarioId]);
164158

165159
const onScenarioToggled = (scenarioId) => {
166160
dispatch(setStorageScenarioAction(scenarioId));
@@ -200,7 +194,6 @@ export const InstallationScenario = ({
200194
isFirstScreen,
201195
isFormDisabled,
202196
setIsFormValid,
203-
showStorage,
204197
}) => {
205198
const headingLevel = isFirstScreen ? "h3" : "h2";
206199
const { diskSelection, storageScenarioId } = useContext(StorageContext);
@@ -231,7 +224,6 @@ export const InstallationScenario = ({
231224
idPrefix={idPrefix}
232225
isFormDisabled={isFormDisabled}
233226
setIsFormValid={setIsFormValid}
234-
showStorage={showStorage}
235227
/>
236228
</FormGroup>
237229
</FormSection>

0 commit comments

Comments
 (0)