Skip to content

Consistent UI for the Environments #1718

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 14 commits into from
May 28, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update to try/catch and async/await
  • Loading branch information
iamfaran committed May 28, 2025
commit 0b505e09f5ee88ff3a617e8bf9857efad36841a6
Original file line number Diff line number Diff line change
Expand Up @@ -28,28 +28,33 @@ const ContactLowcoderModal: React.FC<ContactLowcoderModalProps> = ({

// Fetch deployment ID when modal opens
useEffect(() => {
if (visible && environment.environmentApiServiceUrl && environment.environmentApikey) {
const fetchDeploymentId = async () => {
if (!visible || !environment.environmentApiServiceUrl || !environment.environmentApikey) {
if (visible) {
setError('Environment API service URL or API key not configured');
}
return;
}

setIsLoading(true);
setError(null);

getEnvironmentDeploymentId(
environment.environmentApiServiceUrl,
environment.environmentApikey
)
.then((id) => {
setDeploymentId(id);
setShowHubspotModal(true);
})
.catch((err) => {
console.error('Failed to fetch deployment ID:', err);
setError(err instanceof Error ? err.message : 'Failed to fetch deployment ID');
})
.finally(() => {
setIsLoading(false);
});
} else if (visible) {
setError('Environment API service URL or API key not configured');
}
try {
const id = await getEnvironmentDeploymentId(
environment.environmentApiServiceUrl,
environment.environmentApikey
);
setDeploymentId(id);
setShowHubspotModal(true);
} catch (err) {
console.error('Failed to fetch deployment ID:', err);
setError(err instanceof Error ? err.message : 'Failed to fetch deployment ID');
} finally {
setIsLoading(false);
}
};

fetchDeploymentId();
}, [visible, environment.environmentApiServiceUrl, environment.environmentApikey]);

// Handle HubSpot modal close
Expand Down