From 96627837b2f93f8ab2ee647c125a970e584494c6 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Thu, 22 Jul 2021 16:27:40 +0300 Subject: [PATCH] Island UI: fix a race condition between setting island scenario on the UI and on the backend --- .../cc/ui/src/components/pages/LandingPage.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx b/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx index e25717b7f..308504b50 100644 --- a/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx +++ b/monkey/monkey_island/cc/ui/src/components/pages/LandingPage.tsx @@ -55,8 +55,10 @@ const LandingPageComponent = (props) => { } function setScenario(scenario: string) { - IslandHttpClient.post('/api/island-mode', {'mode': scenario}); - props.onStatusChange(); + IslandHttpClient.post('/api/island-mode', {'mode': scenario}) + .then(() => { + props.onStatusChange(); + }); } }