-
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-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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 thetypeof
comparison.The addition of
useIdletime
toRenderIfVisible
enhances control over rendering during idle times, which is a significant improvement for performance. However, there's an issue with thetypeof
comparison 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
typeof
comparison value: this expression is not a string literalnot a string literal
Unsafe fix: Compare the result oftypeof
with 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
KanbanIssueBlockLoader
component correctly handles thecardHeight
prop to dynamically adjust the height of the loader. The use offorwardRef
and default props is appropriately applied.
14-36
: Effective modularization and conditional rendering.The
KanbanColumnLoader
component 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
KanbanColumnLoader
withinKanbanLayoutLoader
to dynamically render multiple columns based oncardsInEachColumn
effectively 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
KanBan
component effectively utilizessubGroupIndex
andRenderIfVisible
to enhance performance through virtualization and conditional rendering. The dynamic calculation of group heights usinggetApproximateCardHeight
is a notable improvement for handling varying content sizes.web/core/components/issues/issue-layouts/kanban/swimlanes.tsx (1)
158-158
: Verify the usage ofsubGroupIndex
within theKanBan
component.The addition of
subGroupIndex
as a parameter to themap
function and its subsequent passing to theKanBan
component is correctly implemented. However, it is crucial to ensure that this index is utilized effectively within theKanBan
component to enhance performance as intended by the PR.Run the following script to verify the usage of
subGroupIndex
within theKanBan
component:Also applies to: 187-187
Verification successful
Verified: The usage of
subGroupIndex
within theKanBan
component is appropriate.The
subGroupIndex
is correctly passed and utilized within theKanBan
component to control rendering logic, aligning with the PR's objectives of improving performance through virtualization.
subGroupIndex
is defined as an optional property in theIKanBan
interface.- 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
useIdletime
for improved rendering behavior in theRenderIfVisible
component.Kanban
component with subgroup management through the newsubGroupIndex
prop.KanbanColumnLoader
component for improved layout rendering in Kanban views.Bug Fixes
Kanban
component.Refactor