[WEB-2316] chore: Kanban group virtualization#5565
Conversation
WalkthroughThis pull request introduces several enhancements across multiple components, including the addition of new properties and functionalities to improve rendering logic. Key changes include the introduction of the Changes
Suggested labels
Poem
Tip New featuresWalkthrough comment now includes:
Notes:
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 using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (1)
web/core/components/core/render-if-visible-HOC.tsx (1)
Line range hint
14-48: Enhanced rendering control withuseIdletime, but fix thetypeofcomparison.The addition of
useIdletimetoRenderIfVisibleenhances control over rendering during idle times, which is a significant improvement for performance. However, there's an issue with thetypeofcomparison that needs correction:- if (typeof window !== undefined && window.requestIdleCallback && useIdletime) { + if (typeof window !== 'undefined' && window.requestIdleCallback && useIdletime) {This change ensures the correct evaluation of the window object's existence.
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- web/core/components/core/render-if-visible-HOC.tsx (4 hunks)
- web/core/components/issues/issue-layouts/kanban/default.tsx (5 hunks)
- web/core/components/issues/issue-layouts/kanban/swimlanes.tsx (2 hunks)
- web/core/components/issues/issue-layouts/utils.tsx (1 hunks)
- web/core/components/ui/loader/layouts/kanban-layout-loader.tsx (1 hunks)
Additional context used
Biome
web/core/components/core/render-if-visible-HOC.tsx
[error] 42-42: Invalid
typeofcomparison value: this expression is not a string literalnot a string literal
Unsafe fix: Compare the result oftypeofwith a valid type name(lint/suspicious/useValidTypeof)
Additional comments not posted (5)
web/core/components/ui/loader/layouts/kanban-layout-loader.tsx (3)
4-12: Well-implemented dynamic height adjustment.The
KanbanIssueBlockLoadercomponent correctly handles thecardHeightprop to dynamically adjust the height of the loader. The use offorwardRefand default props is appropriately applied.
14-36: Effective modularization and conditional rendering.The
KanbanColumnLoadercomponent effectively uses props to control its behavior and layout, including conditional rendering of the header and dynamic generation of child components. This approach enhances modularity and maintainability.
43-43: Dynamic column rendering aligns with virtualization goals.The use of
KanbanColumnLoaderwithinKanbanLayoutLoaderto dynamically render multiple columns based oncardsInEachColumneffectively supports the virtualization enhancements aimed at improving Kanban performance.web/core/components/issues/issue-layouts/kanban/default.tsx (1)
Line range hint
59-223: Well-implemented virtualization and dynamic rendering enhancements.The
KanBancomponent effectively utilizessubGroupIndexandRenderIfVisibleto enhance performance through virtualization and conditional rendering. The dynamic calculation of group heights usinggetApproximateCardHeightis a notable improvement for handling varying content sizes.web/core/components/issues/issue-layouts/kanban/swimlanes.tsx (1)
158-158: Verify the usage ofsubGroupIndexwithin theKanBancomponent.The addition of
subGroupIndexas a parameter to themapfunction and its subsequent passing to theKanBancomponent is correctly implemented. However, it is crucial to ensure that this index is utilized effectively within theKanBancomponent to enhance performance as intended by the PR.Run the following script to verify the usage of
subGroupIndexwithin theKanBancomponent:Also applies to: 187-187
Verification successful
Verified: The usage of
subGroupIndexwithin theKanBancomponent is appropriate.The
subGroupIndexis correctly passed and utilized within theKanBancomponent to control rendering logic, aligning with the PR's objectives of improving performance through virtualization.
subGroupIndexis defined as an optional property in theIKanBaninterface.- It is used in a conditional expression to determine rendering behavior.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify the usage of `subGroupIndex` within the `KanBan` component. # Test: Search for the usage of `subGroupIndex` within the `KanBan` component. Expect: Proper usage that aligns with performance improvements. rg --type typescript -A 5 $'subGroupIndex'Length of output: 76
Script:
#!/bin/bash # Description: Verify the usage of `subGroupIndex` within the `KanBan` component. # Test: Search for the usage of `subGroupIndex` within .tsx files to ensure proper usage. rg --type-add 'tsx:*.tsx' -t tsx -A 5 'subGroupIndex'Length of output: 3050
|
|
||
| /** | ||
| * Returns approximate height of Kanban card based on display properties | ||
| * @param displayProperties | ||
| * @returns | ||
| */ | ||
| export function getApproximateCardHeight(displayProperties: IIssueDisplayProperties | undefined) { | ||
| if (!displayProperties) return 100; | ||
|
|
||
| // default card height | ||
| let cardHeight = 46; | ||
|
|
||
| const clonedProperties = clone(displayProperties); | ||
|
|
||
| // key adds the height for key | ||
| if (clonedProperties.key) { | ||
| cardHeight += 24; | ||
| } | ||
|
|
||
| // Ignore smaller dimension properties | ||
| const ignoredProperties: (keyof IIssueDisplayProperties)[] = [ | ||
| "key", | ||
| "sub_issue_count", | ||
| "link", | ||
| "attachment_count", | ||
| "created_on", | ||
| "updated_on", | ||
| ]; | ||
|
|
||
| ignoredProperties.forEach((key: keyof IIssueDisplayProperties) => { | ||
| delete clonedProperties[key]; | ||
| }); | ||
|
|
||
| let propertyCount = 0; | ||
|
|
||
| // count the remaining properties | ||
| (Object.keys(clonedProperties) as (keyof IIssueDisplayProperties)[]).forEach((key: keyof IIssueDisplayProperties) => { | ||
| if (clonedProperties[key]) { | ||
| propertyCount++; | ||
| } | ||
| }); | ||
|
|
||
| // based on property count, approximate the height of each card | ||
| if (propertyCount > 3) { | ||
| cardHeight += 60; | ||
| } else if (propertyCount > 0) { | ||
| cardHeight += 32; | ||
| } | ||
|
|
||
| return cardHeight; | ||
| } |
There was a problem hiding this comment.
Approve the implementation of getApproximateCardHeight and suggest adding unit tests.
The implementation of getApproximateCardHeight is well-thought-out and aligns with the PR's objectives to dynamically adjust the Kanban card height based on its content. It is recommended to add unit tests to ensure the function behaves as expected under various scenarios, especially with different combinations of display properties.
Would you like me to help by writing some unit tests for this function?
There was a problem hiding this comment.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- web/core/components/issues/issue-layouts/kanban/default.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (1)
- web/core/components/issues/issue-layouts/kanban/default.tsx
This PR adds group wise virtualization to Kanban groups to fix faster reaction times with large number of groups/columns. This is to make sure the user experiences faster perceived performance.
Summary by CodeRabbit
New Features
useIdletimefor improved rendering behavior in theRenderIfVisiblecomponent.Kanbancomponent with subgroup management through the newsubGroupIndexprop.KanbanColumnLoadercomponent for improved layout rendering in Kanban views.Bug Fixes
Kanbancomponent.Refactor