From 17f975e0ef5a56d2cf5bdb02aa167eb621409967 Mon Sep 17 00:00:00 2001 From: Katarina Sieklova Date: Wed, 12 Mar 2025 14:04:57 +0100 Subject: [PATCH] Wizard: race condition with activation key Fixes #2961 Activation key loads in background even if a user skips to the review step. The unwrap is there to extract only the actual response data, if the query fails, the exception will be caught in the catch block anyways, so there was no need to keep the whole action object. And the refetch was being called before the createActivationKey query was initiallized, throwing an error and not letting the async query in try block to finish fetching the activation key. --- .../steps/Registration/ActivationKeysList.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Components/CreateImageWizard/steps/Registration/ActivationKeysList.tsx b/src/Components/CreateImageWizard/steps/Registration/ActivationKeysList.tsx index 521528ee..5ec88a6c 100644 --- a/src/Components/CreateImageWizard/steps/Registration/ActivationKeysList.tsx +++ b/src/Components/CreateImageWizard/steps/Registration/ActivationKeysList.tsx @@ -164,12 +164,12 @@ const ActivationKeysList = () => { name: defaultActivationKeyName, serviceLevel: 'Self-Support', }, - }); + }).unwrap(); + window.localStorage.setItem( 'imageBuilder.recentActivationKey', defaultActivationKeyName ); - refetch(); dispatch(changeActivationKey(defaultActivationKeyName)); } catch (error) { dispatch(