CreateImageWizard: Fix deselecting selected packages

Deselecting a selected set of package didn't change the state correctly.
This commit is contained in:
Sanne Raymaekers 2021-11-28 16:00:09 +01:00 committed by jkozol
parent 0d5ab8b86b
commit a16212ddc3
3 changed files with 43 additions and 6 deletions

View file

@ -139,14 +139,15 @@ const Packages = ({ defaultArch, ...props }) => {
if (fromAvailable) {
sortPackages(updatedSourcePackages);
setPackagesChosen([ ...destinationPackages ]);
setPackagesChosen(destinationPackages);
// set the steps field to the current chosen packages list
change(input.name, removePackagesDisplayFields(destinationPackages));
} else {
setPackagesChosen(updatedSourcePackages);
sortPackages([ ...destinationPackages ]);
sortPackages(packagesAvailable);
// set the steps field to the current chosen packages list
change(input.name, removePackagesDisplayFields(updatedSourcePackages));
}
// set the steps field to the current chosen packages list
change(input.name, removePackagesDisplayFields(packagesChosen));
};
// move all packages

View file

@ -141,7 +141,7 @@ const ReviewStep = () => {
<TextListItem component={ TextListItemVariants.dt }>
Chosen
</TextListItem>
<TextListItem component={ TextListItemVariants.dd }>
<TextListItem component={ TextListItemVariants.dd } data-testid='chosen-packages-count'>
{getState()?.values?.['selected-packages']?.length || 0}
</TextListItem>
</TextList>