Skip to content

Conversation

@sjbur
Copy link
Contributor

@sjbur sjbur commented Jan 8, 2026

No description provided.

@sjbur sjbur self-assigned this Jan 8, 2026
@sjbur sjbur added the 26_1 label Jan 8, 2026
@sjbur sjbur marked this pull request as ready for review January 8, 2026 17:48
@sjbur sjbur requested a review from a team as a code owner January 8, 2026 17:48
Copilot AI review requested due to automatic review settings January 8, 2026 17:48
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug (T1310524) where the shadeUntilCurrentTime property was inconsistently applied to resource groups outside the viewport when virtual scrolling mode is enabled. The issue occurred because the getRoundedCellWidth method returned 0 for groups that weren't rendered in the DOM due to virtual scrolling, causing the shader width calculation to fail.

Key Changes

  • Added fallback logic in getRoundedCellWidth to use group 0's cell width when a requested group has no rendered elements
  • Tracks the number of found DOM elements to detect when virtualized groups are being queried
  • Added comprehensive test coverage for the virtual scrolling scenario with multiple resource groups

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
packages/devextreme/js/__internal/scheduler/workspaces/m_work_space.ts Implements fallback mechanism in getRoundedCellWidth to return group 0's width when virtualized groups have no rendered DOM elements
packages/devextreme/js/__internal/scheduler/tests/workspace.test.ts Adds new test file with coverage for the virtual scrolling bug scenario, verifying that non-rendered groups return valid cell widths

return width / (totalCellCount + cellCount - startIndex);
const divisor = totalCellCount + cellCount - startIndex;
let result = width / divisor;

Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fallback logic for handling virtualized groups that are not rendered in the DOM is not documented. Consider adding a comment explaining that when virtual scrolling is enabled and a group is not rendered, this fallback uses group 0's cell width as a reference, which is needed for proper shader rendering via the shadeUntilCurrentTime feature.

Suggested change
// When virtual scrolling is enabled, cells for some groups may not be rendered in the DOM.
// In that case, the computed width can be 0 with no elements found for the target group.
// To keep features such as shadeUntilCurrentTime working correctly, fall back to using
// group 0's cell width as a reference for shader rendering.

Copilot uses AI. Check for mistakes.
Comment on lines +1582 to +1589
let foundElements = 0;
for (let i = startIndex; i < totalCellCount + cellCount; i++) {
const element = $($cells).eq(i).get(0);
const elementWidth = element ? getBoundingRect(element).width : 0;
width += elementWidth;
if (element) {
foundElements++;
}
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The variable name 'foundElements' could be more descriptive to clarify its purpose. Consider renaming it to 'renderedElementCount' to better convey that it tracks the number of DOM elements that were actually found and rendered.

Copilot uses AI. Check for mistakes.
Comment on lines +10 to +14
const CLASSES = {
scheduler: 'dx-scheduler',
workSpace: 'dx-scheduler-work-space',
shaderTop: 'dx-scheduler-date-time-shader-top',
};
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CLASSES object defines 'workSpace' and 'shaderTop' properties that are not used in this test. Consider removing these unused properties or adding additional test assertions that use them to verify the shader rendering behavior.

Copilot uses AI. Check for mistakes.
cellCount,
);

expect(lastGroupWidth).toBeGreaterThan(0);
Copy link

Copilot AI Jan 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test assertion only verifies that lastGroupWidth is greater than 0, but doesn't verify that it matches group 0's width. Consider adding an assertion that compares the last group's width to the first group's width to ensure the fallback mechanism is working correctly: expect(lastGroupWidth).toBe(workSpace.getRoundedCellWidth(0, 0, cellCount)).

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant