Fix: Remove incorrect await in sales utils (issue #6424)#6466
Fix: Remove incorrect await in sales utils (issue #6424)#6466munkhsaikhan merged 1 commit intoerxes:mainfrom
Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideRemoved incorrect use of the Class diagram for getItemList and getExtraFields usage updateclassDiagram
class getItemList {
<<async>>
+getItemList(items, getExtraFields?)
}
class getExtraFields {
<<optional>>
+getExtraFields(item) { [key: string]: any }
}
getItemList --> "optional" getExtraFields: calls
File-Level Changes
Possibly linked issues
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
WalkthroughA change in getItemList within sales utils replaces an awaited call to getExtraFields(item) with a direct, non-awaited spread of getExtraFields(item), altering control flow when getExtraFields is asynchronous. Changes
Sequence Diagram(s)sequenceDiagram
participant C as Caller
participant U as getItemList
participant E as getExtraFields
Note over U: Previous behavior (await)
C->>U: getItemList(items, getExtraFields)
U->>E: getExtraFields(item)
E-->>U: extraFields (resolved)
U-->>C: item {...extraFields}
break Current behavior (no await)
C->>U: getItemList(items, getExtraFields)
U->>E: getExtraFields(item)
E-->>U: Promise<extraFields>
U-->>C: item {...Promise}<br/>(Promise spread attempted)
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx}📄 CodeRabbit inference engine (.cursorrules)
Files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Important
Looks good to me! 👍
Reviewed everything up to 59d2638 in 17 seconds. Click for details.
- Reviewed
13lines of code in1files - Skipped
0files when reviewing. - Skipped posting
1draft comments. View those below. - Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.
1. backend/plugins/sales_api/src/modules/sales/utils.ts:705
- Draft comment:
Good fix: removing 'await' is correct since getExtraFields is synchronous. Make sure to update the usage if getExtraFields ever becomes async. - Reason this comment was not posted:
Comment did not seem useful. Confidence is useful =0%<= threshold50%The comment is informative and suggests a future action if the function changes, which is not actionable for the current PR. It doesn't provide a specific code suggestion or ask for a test to be written. It also doesn't point out a potential issue with the current code.
Workflow ID: wflow_PFmgFjkvlxc5JS3t
You can customize by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.
|
|
@Amura7 @maxnowack @munkhorgil @batnasan , kindly help me to review my PR when you have time, Thank You |
What
Removes incorrect
awaitkeyword used with a non-Promise returning function inbackend/plugins/sales_api/src/modules/sales/utils.ts.Why
Fixes issue #6424 - The
getExtraFieldsfunction parameter is defined as a synchronous function that returns a plain object, not a Promise. Usingawaiton it causes a TypeScript/ESLint error and is semantically incorrect.How
awaitkeyword from line 705 wheregetExtraFields(item)is calledgetExtraFields?: (item: any) => { [key: string]: any }which returns a plain object synchronously, so noawaitis neededTesting
awaitkeyword, which resolves the type error without affecting functionalityRelated Issue: #6424
Important
Remove unnecessary
awaitfrom synchronousgetExtraFields(item)call ingetItemList()inutils.ts.awaitfromgetExtraFields(item)call ingetItemList()inutils.ts.getExtraFieldsis a synchronous function returning a plain object, not a Promise.This description was created by
for 59d2638. You can customize this summary. It will automatically update as commits are pushed.
Summary by CodeRabbit