-
Notifications
You must be signed in to change notification settings - Fork 52
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
fix: better error handling in components #1642
base: main
Are you sure you want to change the base?
Conversation
src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx
Outdated
Show resolved
Hide resolved
4f28c6b
to
831179f
Compare
62bf157
to
bc4e2c4
Compare
@@ -1112,32 +1112,6 @@ export const reloadToastBody = () => { | |||
) | |||
} | |||
|
|||
export function useHeightObserver(callback): [RefObject<HTMLDivElement>] { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The contents of the custom hook seem a little convoluted and unnecessary to me. Since this is (was) being used only in TerminalView, I have refactored it out. React warns us from using useLayoutEffect anyways. The motive was probably that the actually resizing should be differed to the next repaint to prevent infinite loops in ResizeObserver callback. We shouldn't change the div size inside the resizeObserver. Thus using window.requestAnimationFrame will defer the actual resize until the next repaint saving us from the infinite resize.
src/components/ApplicationGroup/Details/TriggerView/EnvTriggerView.tsx
Outdated
Show resolved
Hide resolved
src/components/EnvironmentOverride/DeploymentTemplateOverrideForm.tsx
Outdated
Show resolved
Hide resolved
src/components/deploymentConfig/DeploymentTemplateView/DeploymentConfigFormCTA.tsx
Outdated
Show resolved
Hide resolved
@@ -518,7 +518,7 @@ export default function DeploymentConfig({ | |||
const deploymentTemplateResp = isProtected | |||
? await checkForProtectedLockedChanges() | |||
: await getIfLockedConfigNonProtected(requestBody) | |||
if (deploymentTemplateResp.result.isLockConfigError) { | |||
if (deploymentTemplateResp.result?.isLockConfigError) { | |||
setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vivek-devtron Do I need to remove these optional chaining checks on line 552 and 553?
@@ -566,7 +566,7 @@ export default function DeploymentConfig({ | |||
const requestBody = prepareDataToSave(true) | |||
const api = state.chartConfig.id ? updateDeploymentTemplate : saveDeploymentTemplate | |||
const deploymentTemplateResp = await api(requestBody, baseDeploymentAbortController.signal) | |||
if (deploymentTemplateResp.result.isLockConfigError) { | |||
if (deploymentTemplateResp.result?.isLockConfigError) { | |||
setDisableSaveEligibleChanges(deploymentTemplateResp.result?.disableSaveEligibleChanges) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here?
6fcb9e6
to
f330de6
Compare
modified EnvTriggerView.tsx & TriggerView.tsx
Changes in appDetails/AppDetails.tsx, details/main.tsx & appDetails/AppDetails.component.tsx
Modifications in login/Login.tsx
@@ -216,6 +216,7 @@ export default function EnvTriggerView({ filteredAppIds, isVirtualEnv }: AppGrou | |||
setDefaultConfig(_isDefaultConfig) | |||
setConfigPresent(isConfigPresent) | |||
}) | |||
.catch() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Confirm with @arunjaindev
edit renderSideInfoColumn in EnvironmentOverview.tsx
06a1e93
to
3a5939f
Compare
edit in deploymentConfig/DeploymentConfig.tsx
Quality Gate passedIssues Measures |
Description
An optional check is required since upon failure of the preceding api calls can return response objects without the result property field. (See fetchInTime & put) in devtron-fe-common-lib.
Added some missing catch blocks to api calls that can throw errors.
Fixed
ResizeObserver loop finished with undelivered notifications
error encountered upon resizing the window when the appDetails terminal is in view. Additionally refactored the code.Future Work:
Fixes devtron-labs/devtron#4710
Type of change
How Has This Been Tested?
Checklist: