-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Nc fix/shared view filter #8837
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
Conversation
|
Warning Rate limit exceeded@o1lab has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 16 minutes and 39 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThe recent changes across multiple files involve improvements to filtering and error handling mechanisms. Key updates include the consolidation of filtering logic in Vue components, the addition of a new parameter to the Changes
Sequence Diagram(s)The changes are too varied and independent for a meaningful sequence diagram. Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
12f0c89 to
3b49ba5
Compare
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.
Actionable comments posted: 4
Outside diff range and nitpick comments (2)
packages/nocodb/src/db/conditionV2.ts (2)
Line range hint
457-457: ReplaceisNaNwithNumber.isNaNfor type safety.The use of
isNaNcan lead to unexpected results due to type coercion. It's safer to useNumber.isNaN, which does not coerce the types and only returns true for values of the type number.- isNaN(+filter.value) + Number.isNaN(+filter.value) - isNaN(+genVal) + Number.isNaN(+genVal) - isNaN(+genVal) + Number.isNaN(+genVal)Also applies to: 483-483, 699-699
Line range hint
105-1237: Consider removing redundant else clauses.Multiple static analysis hints suggest that the else clauses are redundant due to early returns or breaks in the previous branches. Removing these could simplify the code and reduce nesting, enhancing readability.
- else { - // code block - }Also applies to: 128-1237, 163-171, 221-225, 274-427, 286-290, 344-427, 360-364, 430-1236, 439-1236, 464-1236, 492-1236, 512-520, 516-520, 577-1236, 1317-1403, 1351-1403
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (4)
- packages/nc-gui/components/smartsheet/toolbar/ColumnFilter.vue (3 hunks)
- packages/nc-gui/composables/useViewFilters.ts (4 hunks)
- packages/nocodb/src/db/conditionV2.ts (2 hunks)
- packages/nocodb/src/helpers/columnHelpers.ts (1 hunks)
Additional context used
Biome
packages/nc-gui/composables/useViewFilters.ts
[error] 91-96: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 93-96: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 155-157: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 158-167: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 164-166: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 187-190: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 355-357: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 133-133: Avoid the use of spread (
...) syntax on accumulators. (lint/performance/noAccumulatingSpread)Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).
Consider methods such as .splice or .push instead.packages/nocodb/src/db/conditionV2.ts
[error] 105-1237: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 128-1237: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 163-171: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 221-225: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 274-427: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 286-290: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 344-427: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 360-364: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 430-1236: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 439-1236: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 464-1236: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 492-1236: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 512-520: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 516-520: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 577-1236: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 1317-1403: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
Unsafe fix: Omit the else clause.
[error] 1351-1403: This else clause can be omitted because previous branches break early. (lint/style/noUselessElse)
[error] 457-457: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 483-483: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
[error] 699-699: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead. (lint/suspicious/noGlobalIsNan)
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.
Additional comments not posted (5)
packages/nocodb/src/helpers/columnHelpers.ts (1)
416-416: Handle null column parameter gracefully.The added null check for the
columnparameter ingetRefColumnIfAliasfunction is a good safety measure to prevent potential runtime errors from null dereferencing. This change enhances the robustness of the function.packages/nc-gui/composables/useViewFilters.ts (3)
25-25: Addition offieldsToFilterparameter.The inclusion of
fieldsToFilteras an optional parameter allows for more granular control over which columns are considered for filtering, enhancing the flexibility of theuseViewFiltersfunction. This change aligns with the PR's objective to improve column filtering capabilities.
202-202: Use of optional chaining and nullish coalescing.The implementation of
fieldsToFilter?.value?.[0]?.id ?? undefineduses modern JavaScript features like optional chaining and nullish coalescing to safely access properties and handle undefined cases. This ensures thatfk_column_idis either a valid id or undefined, preventing potential runtime errors.
510-510: Proper handling of array manipulation in a reactive context.The use of
spliceto remove a filter fromfilters.valueis correctly implemented within Vue's reactivity system. This operation ensures that the UI and state remain synchronized after a filter is deleted.packages/nocodb/src/db/conditionV2.ts (1)
129-129: Remove unnecessary early return.The early return when
filter.fk_column_idis not present is correctly placed to prevent further execution if the ID is missing. This is crucial for avoiding runtime errors when the subsequent code expects a valid ID.
|
Uffizzi Preview |
3b49ba5 to
63cece2
Compare
63cece2 to
06a8aea
Compare
Change Summary
Provide summary of changes with issue number if any.
Change type
Test/ Verification
Provide summary of changes.
Additional information / screenshots (optional)
Anything for maintainers to be made aware of