-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
[WEB-2001] fix: Issue local cache fixes #5703
Changes from all commits
7264fb1
c15d22a
4f2c29c
c0c8ed9
ed1470f
9c6aaec
a00bdf2
75a022c
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 |
---|---|---|
|
@@ -6,6 +6,7 @@ import { | |
singleFilterConstructor, | ||
translateQueryParams, | ||
} from "./query.utils"; | ||
import { log } from "./utils"; | ||
export const SPECIAL_ORDER_BY = { | ||
labels__name: "labels", | ||
"-labels__name": "labels", | ||
|
@@ -47,7 +48,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st | |
|
||
`; | ||
|
||
console.log("###", sql); | ||
log("###", sql); | ||
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. 💡 Codebase verification Issues Found: Inconsistent Logging Practices Across the Codebase The shell script analysis revealed multiple instances of Affected Files:
🔗 Analysis chainLGTM: Replaced console.log with custom log function. The change is consistent with the described modifications. However, consider the following:
To verify logging practices, run: 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Check for other instances of console.log and log function usage
rg --type typescript 'console\.log|log\(' web/
Length of output: 83 Script: #!/bin/bash
# Check for other instances of console.log and log function usage in TypeScript files
rg 'console\.log|log\(' web/ --type-add 'typescript:*.{ts,tsx}' --type typescript
Length of output: 3722 |
||
|
||
return sql; | ||
} | ||
|
@@ -63,7 +64,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st | |
WHERE rank <= ${per_page} | ||
`; | ||
|
||
console.log("###", sql); | ||
log("###", sql); | ||
|
||
return sql; | ||
} | ||
|
@@ -119,7 +120,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st | |
`; | ||
sql += ` group by i.id ${orderByString} LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`; | ||
|
||
console.log("######$$$", sql); | ||
log("######$$$", sql); | ||
return sql; | ||
} | ||
|
||
|
@@ -148,7 +149,7 @@ export const issueFilterQueryConstructor = (workspaceSlug: string, projectId: st | |
// Add offset and paging to query | ||
sql += ` LIMIT ${pageSize} OFFSET ${offset * 1 + page * pageSize};`; | ||
|
||
console.log("$$$", sql); | ||
log("$$$", sql); | ||
return sql; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,14 +11,15 @@ import { | |
memberSchema, | ||
optionsSchema, | ||
} from "./schemas"; | ||
import { log } from "./utils"; | ||
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. 💡 Codebase verification Remaining While the centralized
Please replace these 🔗 Analysis chainApprove the addition of centralized logging utility. The introduction of a centralized To ensure this change is implemented consistently, let's verify the 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Verify the implementation and usage of the `log` function
# Test 1: Check the implementation of the `log` function
echo "Checking the implementation of the log function:"
rg --type typescript 'export (const|function) log' ./web/core/local-db/utils/
# Test 2: Check for any remaining direct console.log calls in the local-db directory
echo "Checking for any remaining direct console.log calls in the local-db directory:"
rg --type typescript 'console\.log' ./web/core/local-db/
# Test 3: Check the usage of the new log function across the codebase
echo "Checking the usage of the new log function across the codebase:"
rg --type typescript 'log\(' ./web/
Length of output: 692 Script: #!/bin/bash
# Description: Verify the implementation and usage of the `log` function without using --type flag
# Test 1: Check the implementation of the `log` function
echo "Checking the implementation of the log function:"
rg 'export (const|function) log' ./web/core/local-db/utils/ --glob '*.ts' --glob '*.tsx'
# Test 2: Check for any remaining direct console.log calls in the local-db directory
echo "Checking for any remaining direct console.log calls in the local-db directory:"
rg 'console\.log' ./web/core/local-db/ --glob '*.ts' --glob '*.tsx'
# Test 3: Check the usage of the new log function across the codebase
echo "Checking the usage of the new log function across the codebase:"
rg 'log\(' ./web/ --glob '*.ts' --glob '*.tsx'
Length of output: 4700 |
||
|
||
const createTableSQLfromSchema = (tableName: string, schema: Schema) => { | ||
let sql = `CREATE TABLE IF NOT EXISTS ${tableName} (`; | ||
sql += Object.keys(schema) | ||
.map((key) => `'${key}' ${schema[key]}`) | ||
.join(", "); | ||
sql += `);`; | ||
console.log("#####", sql); | ||
log("#####", sql); | ||
return sql; | ||
}; | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,13 @@ import { TIssue } from "@plane/types"; | |
import { rootStore } from "@/lib/store-context"; | ||
import { updateIssue } from "./load-issues"; | ||
|
||
export const log = console.log; | ||
|
||
// export const log = () => {}; | ||
export const log = (...args: any) => { | ||
if ((window as any).DEBUG) { | ||
console.log(...args); | ||
} | ||
}; | ||
export const logError = console.error; | ||
export const logInfo = console.info; | ||
Comment on lines
+11
to
+12
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 Consider applying conditional logging to The addition of For consistency and to have better control over all types of logging, consider applying the same conditional logic to these functions: export const logError = (...args: any[]) => {
if (window.DEBUG) {
console.error(...args);
}
};
export const logInfo = (...args: any[]) => {
if (window.DEBUG) {
console.info(...args);
}
}; This change would ensure that all logging functions behave consistently and can be controlled via the DEBUG flag, which is particularly useful when transitioning between development and production environments. |
||
|
||
export const updatePersistentLayer = async (issueIds: string | string[]) => { | ||
if (typeof issueIds === "string") { | ||
|
@@ -44,7 +48,7 @@ export const updatePersistentLayer = async (issueIds: string | string[]) => { | |
"module_ids", | ||
"type_id", | ||
]); | ||
updateIssue(issuePartial); | ||
updateIssue({ ...issuePartial, is_local_update: 1 }); | ||
} | ||
}); | ||
}; | ||
|
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.
💡 Codebase verification
Action Required: Direct console calls detected.
The verification script found multiple direct
console.log
,console.error
, andconsole.warn
calls that should be replaced with the new logging functions to maintain consistent log management.Examples of affected files:
web/app/workspace-invitations/page.tsx
web/core/components/issues/issue-detail/root.tsx
web/helpers/string.helper.ts
packages/editor/src/core/plugins/image/restore-image.ts
admin/app/authentication/github/form.tsx
Please refactor these instances to use the appropriate logging functions (
logError
,logInfo
,log
) from./utils/utils
to ensure consistency and improve log management across the codebase.🔗 Analysis chain
LGTM: Improved logging imports.
The introduction of specific logging functions (
logError
,logInfo
,log
) is a good practice for better log management and filtering.To ensure consistency across the codebase, please run the following script to check for any remaining direct console calls that should be replaced:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
Length of output: 77
Script:
Length of output: 21289