-
-
Notifications
You must be signed in to change notification settings - Fork 790
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
Small SAST fixes #8534
Small SAST fixes #8534
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,7 +84,7 @@ export const getPluginTemplateEditor = ( | |
useEffect(() => { | ||
(async () => { | ||
try { | ||
await func({ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Isn't the await needed here so that asynchronous errors are catched too? But not sure about it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be asynchronous if https://github.com/inventree/InvenTree/blob/master/src/frontend/src/components/plugins/PluginUIFeatureTypes.ts#L1is defined as a promise by the individual feature. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But you’re right, in this case it can’t be async, so its fine removing it. Good catch. Or we could define it as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TBH all of those were caught by SonarCloud and were marked as middle to high importance so I mainly fixed them to get the quality gate back to good-ish before the release |
||
func({ | ||
ref: elRef.current!, | ||
registerHandlers: ({ getCode, setCode }) => { | ||
setCodeRef.current = setCode; | ||
|
@@ -136,7 +136,7 @@ export const getPluginTemplatePreview = ( | |
useEffect(() => { | ||
(async () => { | ||
try { | ||
await func({ | ||
func({ | ||
ref: elRef.current!, | ||
registerHandlers: ({ updatePreview }) => { | ||
updatePreviewRef.current = updatePreview; | ||
|
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 'default' case should return a value here still, otherwise you are changing functionality.
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.
Are you sure?
default
is empty in the current code baseThere 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.
scratch that