[released bug] Fleet UI: Final piece to keep form state when toggling new policy modal (#18917)

Co-authored-by: Sarah Gillespie <73313222+gillespi314@users.noreply.github.com>
This commit is contained in:
RachelElysia 2024-05-10 16:30:30 -04:00 committed by GitHub
parent 4047300fcd
commit ed3c7037a5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -246,10 +246,9 @@ const PolicyForm = ({
});
}
let selectedPlatforms: OsqueryPlatform[] = [];
if (isEditMode || defaultPolicy) {
selectedPlatforms = getSelectedPlatforms();
} else {
let selectedPlatforms = getSelectedPlatforms();
if (selectedPlatforms.length === 0 && !isEditMode && !defaultPolicy) {
// If no platforms are selected, default to all compatible platforms
selectedPlatforms = getCompatiblePlatforms();
setSelectedPlatforms(selectedPlatforms);
}