Skip to content

Commit

Permalink
use effect fix
Browse files Browse the repository at this point in the history
  • Loading branch information
pavloburchak committed Aug 4, 2023
1 parent c498db1 commit e27bf1a
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,16 +94,16 @@ const App: React.FC<AppProps> = ({plugins}) => {
useEffect(() => {
// Do not fire the effect if new endpoint is just being set up,
// or it can't be changed.
if (location.pathname === '/apiEndpoint' || isApiEndpointLocked()) {
if (location.pathname === '/apiEndpoint') {
return;
}

if (!apiEndpoint) {
if (!apiEndpoint && !isApiEndpointLocked()) {
setEndpointModalState(true);
return;
}

getApiDetails(apiEndpoint)
getApiDetails(apiEndpoint!)
.then(setClusterDetails)
.catch(() => {
// Handle race condition
Expand All @@ -113,7 +113,9 @@ const App: React.FC<AppProps> = ({plugins}) => {

// Display popup
notificationCall('failed', 'Could not receive data from the specified API endpoint');
setEndpointModalState(true);
if (isApiEndpointLocked()) {
setEndpointModalState(true);
}
});
}, [apiEndpoint]);

Expand Down

0 comments on commit e27bf1a

Please sign in to comment.