-
Notifications
You must be signed in to change notification settings - Fork 4.5k
fix: TASK-#15126 Airtable queries able to show the total count of rec… #34467
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
base: release
Are you sure you want to change the base?
Changes from 4 commits
1389812
74b7b08
d49ebe5
c2b4caf
28468bb
97784ad
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -51,6 +51,27 @@ interface QueryDebuggerTabsProps { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onRunClick: () => void; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| showSchema?: boolean; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const parseResponseBody = (body: any): any[] => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| let parsedOutput: any; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (typeof body === "string") { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| try { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parsedOutput = JSON.parse(body); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } catch (e) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [{ response: body }]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| parsedOutput = body; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (Array.isArray(parsedOutput)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return parsedOutput; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } else if (parsedOutput.records && Array.isArray(parsedOutput.records)) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return parsedOutput.records; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return [parsedOutput]; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const parseResponseBody = (body: any): any[] => { | |
| let parsedOutput: any; | |
| if (typeof body === "string") { | |
| try { | |
| parsedOutput = JSON.parse(body); | |
| } catch (e) { | |
| return [{ response: body }]; | |
| } | |
| } else { | |
| parsedOutput = body; | |
| } | |
| if (Array.isArray(parsedOutput)) { | |
| return parsedOutput; | |
| } else if (parsedOutput.records && Array.isArray(parsedOutput.records)) { | |
| return parsedOutput.records; | |
| } | |
| return [parsedOutput]; | |
| const parseResponseBody = (body: any): any[] => { | |
| let parsedOutput: any; | |
| if (typeof body === "string") { | |
| try { | |
| parsedOutput = JSON.parse(body); | |
| } catch (e) { | |
| return [{ response: body }]; | |
| } | |
| } else { | |
| parsedOutput = body; | |
| } | |
| if (Array.isArray(parsedOutput)) { | |
| return parsedOutput; | |
| } | |
| if (parsedOutput.records && Array.isArray(parsedOutput.records)) { | |
| return parsedOutput.records; | |
| } | |
| return [parsedOutput]; | |
| }; |
Tools
Biome
[error] 69-71: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
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.
Refactor suggestion: Simplify JSON parsing and response handling.
The function parseResponseBody is intended to handle various data structures. However, the current implementation can be optimized by removing redundant else clauses as indicated by the static analysis. This will improve readability and reduce unnecessary nesting.
const parseResponseBody = (body: any): any[] => {
let parsedOutput: any;
if (typeof body === "string") {
try {
parsedOutput = JSON.parse(body);
} catch (e) {
return [{ response: body }];
}
} else {
parsedOutput = body;
}
if (Array.isArray(parsedOutput)) {
return parsedOutput;
} else if (parsedOutput.records && Array.isArray(parsedOutput.records)) {
return parsedOutput.records;
}
return [parsedOutput];
};Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const parseResponseBody = (body: any): any[] => { | |
| let parsedOutput: any; | |
| if (typeof body === "string") { | |
| try { | |
| parsedOutput = JSON.parse(body); | |
| } catch (e) { | |
| return [{ response: body }]; | |
| } | |
| } else { | |
| parsedOutput = body; | |
| } | |
| if (Array.isArray(parsedOutput)) { | |
| return parsedOutput; | |
| } else if (parsedOutput.records && Array.isArray(parsedOutput.records)) { | |
| return parsedOutput.records; | |
| } else { | |
| return [parsedOutput]; | |
| } | |
| }; | |
| const parseResponseBody = (body: any): any[] => { | |
| let parsedOutput: any; | |
| if (typeof body === "string") { | |
| try { | |
| parsedOutput = JSON.parse(body); | |
| } catch (e) { | |
| return [{ response: body }]; | |
| } | |
| } else { | |
| parsedOutput = body; | |
| } | |
| if (Array.isArray(parsedOutput)) { | |
| return parsedOutput; | |
| } | |
| if (parsedOutput.records && Array.isArray(parsedOutput.records)) { | |
| return parsedOutput.records; | |
| } | |
| return [parsedOutput]; | |
| }; |
Tools
Biome
[error] 69-73: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 71-73: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
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.
we can remove else from the line 69 also