From d706bfc7bc1912af294979c7ddce1d7a6b6e43eb Mon Sep 17 00:00:00 2001 From: Fredrik Strand Oseberg Date: Fri, 26 Nov 2021 13:15:39 +0100 Subject: [PATCH] fix: use specific attribute as useEffect trigger (#527) * fix: use specific attribute as useEffect trigger * fix: handle splash being undefined --- .../cypress/integration/feature-toggle/feature.spec.js | 10 ---------- frontend/src/component/App.tsx | 7 +++++-- 2 files changed, 5 insertions(+), 12 deletions(-) diff --git a/frontend/cypress/integration/feature-toggle/feature.spec.js b/frontend/cypress/integration/feature-toggle/feature.spec.js index 63d3f4bff2..404951534c 100644 --- a/frontend/cypress/integration/feature-toggle/feature.spec.js +++ b/frontend/cypress/integration/feature-toggle/feature.spec.js @@ -67,16 +67,6 @@ describe('feature toggle', () => { cy.get('[data-test="LOGIN_PASSWORD_ID"]').type('qY70$NDcJNXA'); cy.get("[data-test='LOGIN_BUTTON']").click(); - - cy.request({ - method: 'POST', - url: `${ - Cypress.config().baseUrl - }/api/admin/features/${featureToggleName}`, - headers: { - Authorization: authToken, - }, - }); } else { cy.get('[data-test=LOGIN_EMAIL_ID]').type('test@unleash-e2e.com'); cy.get('[data-test=LOGIN_BUTTON]').click(); diff --git a/frontend/src/component/App.tsx b/frontend/src/component/App.tsx index 7c060a0935..bb129fca77 100644 --- a/frontend/src/component/App.tsx +++ b/frontend/src/component/App.tsx @@ -36,9 +36,12 @@ const App = ({ location, user, fetchUiBootstrap }: IAppProps) => { }, [user.authDetails?.type]); useEffect(() => { - setShowSplash(!splash?.environments && !isUnauthorized()); + if (splash?.environments === undefined) return; + if (!splash?.environments && !isUnauthorized()) { + setShowSplash(true); + } /* eslint-disable-next-line */ - }, [splash]); + }, [splash.environments]); const renderMainLayoutRoutes = () => { return routes.filter(route => route.layout === 'main').map(renderRoute);