Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ type MockInternalBootSelection = {

type InternalBootVm = {
poolMode: 'dedicated' | 'hybrid';
selectedDevices: Array<string | undefined>;
getDeviceSelectItems: (index: number) => Array<{ value: string; label: string; disabled?: boolean }>;
};

Expand Down Expand Up @@ -511,13 +512,16 @@ describe('OnboardingInternalBootStep', () => {
expect(vm.getDeviceSelectItems(0)).toEqual(
expect.arrayContaining([expect.objectContaining({ value: 'DEDICATED-6GIB' })])
);
vm.selectedDevices[0] = 'DEDICATED-6GIB';
await flushPromises();

vm.poolMode = 'hybrid';
await flushPromises();

expect(vm.getDeviceSelectItems(0)).not.toEqual(
expect.arrayContaining([expect.objectContaining({ value: 'DEDICATED-6GIB' })])
);
expect(vm.selectedDevices[0]).toBeUndefined();
await wrapper.get('[data-testid="internal-boot-eligibility-toggle"]').trigger('click');
await flushPromises();
expect(wrapper.text()).toContain('DEDICATED-6GIB - 6.4 GB (sda)');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -550,11 +550,17 @@ watch(
);

watch(poolMode, (mode) => {
slotCount.value = 1;
selectedDevices.value = [undefined];
updateBios.value = templateData.value?.defaultUpdateBios ?? true;
applyBootSizeSelection(templateData.value?.defaultBootSizeMiB ?? DEFAULT_BOOT_SIZE_MIB);
Comment on lines +553 to +556
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Skip form reset during initial mode hydration

This watcher now unconditionally resets mode-sensitive fields whenever poolMode changes, but initializeForm sets poolMode from draftStore.internalBootSelection on mount. When a saved selection is in hybrid mode, that initial poolMode assignment triggers this reset and wipes hydrated values (selected devices, slot count, boot size, BIOS toggle, and effectively pool name defaults), so users returning to the step lose previously saved hybrid configuration before interacting.

Useful? React with 👍 / 👎.


if (mode === 'dedicated') {
poolName.value = 'boot';
} else if (poolName.value === 'boot') {
poolName.value = templateData.value?.poolNameDefault ?? '';
return;
}

poolName.value = templateData.value?.poolNameDefault ?? '';
});

const isDeviceDisabled = (deviceId: string, index: number) => {
Expand Down
Loading