-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[WEB-2706] fix: Make SQL transactions smaller #6085
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
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 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,4 +1,5 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import differenceInCalendarDays from "date-fns/differenceInCalendarDays"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import isEmpty from "lodash/isEmpty"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import set from "lodash/set"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { v4 as uuidv4 } from "uuid"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // types | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -308,3 +309,17 @@ export const getComputedDisplayProperties = ( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| cycle: displayProperties?.cycle ?? true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| issue_type: displayProperties?.issue_type ?? true, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /** | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * This is to check if the issues list api should fall back to server or use local db | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @param queries | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| * @returns | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| */ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export const getIssuesShouldFallbackToServer = (queries: any) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If there is expand query and is not grouped then fallback to server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!isEmpty(queries.expand as string) && !queries.group_by) return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| // If query has mentions then fallback to server | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!isEmpty(queries.mentions)) return true; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+313
to
+325
Contributor
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. 🛠️ Refactor suggestion Improve type safety and documentation of the fallback function. While the function implements the required fallback logic, there are several improvements that could make it more robust:
Consider this implementation: +interface IssueListQueries {
+ expand?: string;
+ group_by?: string;
+ mentions?: string;
+}
/**
+ * Determines if the issues list API should fall back to server-side processing
+ * @param queries - The query parameters for the issues list
+ * @param queries.expand - Expansion options for the response
+ * @param queries.group_by - Field to group results by
+ * @param queries.mentions - Filter for mentioned users
+ * @returns boolean - True if should use server, false if can use local DB
+ */
-export const getIssuesShouldFallbackToServer = (queries: any) => {
+export const getIssuesShouldFallbackToServer = (queries: IssueListQueries): boolean => {
+ if (!queries) return false;
+
// If there is expand query and is not grouped then fallback to server
if (!isEmpty(queries.expand as string) && !queries.group_by) return true;
// If query has mentions then fallback to server
if (!isEmpty(queries.mentions)) return true;
return false;
};📝 Committable suggestion
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Uh oh!
There was an error while loading. Please reload this page.