Skip to content
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: Prevent crashes when accessing cluster details #911

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

am6737
Copy link
Contributor

@am6737 am6737 commented Oct 4, 2024

  • Added optional chaining to safely access cluster details in AddClusterDialog.

This fix addresses the issue where the page crashes when trying to load details for an inaccessible cluster.

Description of your changes

Fixes #685

I have:

  • Read and followed KubeVela's contribution process.
  • Related Docs updated properly. In a new feature or configuration option, an update to the documentation is necessary.
  • Run yarn lint to ensure the frontend changes are ready for review.
  • Run make reviewableto ensure the server changes are ready for review.
  • Added backport release-x.y labels to auto-backport this PR if necessary.

Special notes for your reviewer

onClose = () => {
this.props.onClose();
this.resetField();
};

onOk = () => {
const { editMode, cluster } = this.state;
const { editClusterName } = this.props;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the need for this code change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the need for this code change?

Thank you for pointing this out! I'll go ahead and remove it to clean up the code.

- Added optional chaining to safely access cluster details in `AddClusterDialog`.

This fix addresses the issue where the page crashes when trying to load details for an inaccessible cluster.

Signed-off-by: am6737 <1359816810@qq.com>
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 51.06%. Comparing base (2ab672c) to head (a7dc707).
Report is 6 commits behind head on main.

❗ There is a different number of reports uploaded between BASE (2ab672c) and HEAD (a7dc707). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (2ab672c) HEAD (a7dc707)
apiserver-unittests 1 0
server-e2e-tests 2 1
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #911      +/-   ##
==========================================
- Coverage   59.01%   51.06%   -7.96%     
==========================================
  Files         116      116              
  Lines       19846    16511    -3335     
==========================================
- Hits        11713     8431    -3282     
- Misses       6696     6835     +139     
+ Partials     1437     1245     -192     
Flag Coverage Δ
apiserver-unittests ?
server-e2e-tests 51.06% <ø> (+2.74%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@am6737 am6737 requested a review from barnettZQG October 14, 2024 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

The page crashes after click an inaccessible cluster
3 participants