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
#7735: adds very basic null checks to prevent NPE #7754
#7735: adds very basic null checks to prevent NPE #7754
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7754 +/- ##
=======================================
Coverage 72.13% 72.14%
=======================================
Files 1269 1269
Lines 39765 39768 +3
Branches 7375 7378 +3
=======================================
+ Hits 28685 28689 +4
+ Misses 11080 11079 -1 ☔ View full report in Codecov by Sentry. |
blockConfig, | ||
} = useSelector(selectActiveNodeInfo) ?? {}; | ||
const { comments } = blockConfig ?? {}; |
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.
nit: I think this can be simplified to:
blockConfig: { comments = {} },
} = useSelector(selectActiveNodeInfo) ?? {};
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.
I think it would have to be:
const {
blockId: brickId,
path: brickFieldName,
blockConfig: { comments },
} = useSelector(selectActiveNodeInfo) ?? { blockConfig: {} };
Which I find harder to read.
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.
Oh right, the actual right way to right this is:
const {
blockId: brickId,
path: brickFieldName,
blockConfig: { comments} = {},
} = activeNodeInfo ?? {};
e: but in the above case comments would still be undefined, so your suggestion works better
No loom links were found in the first post. Please add one there if you'd like to it to appear on Slack. Do not edit this comment manually. |
What does this PR do?
Discussion
tsconfig.strictNullChecks.json
, but that threw 500+ errors (not surprising since it imports from editorSelectors)Checklist