Skip to content

fix: prevent Gantt crash when zoomScale is configured without scales#5202

Open
Jian-Zhang08 wants to merge 1 commit into
VisActor:developfrom
Jian-Zhang08:fix/gantt-sort-scales-no-scales
Open

fix: prevent Gantt crash when zoomScale is configured without scales#5202
Jian-Zhang08 wants to merge 1 commit into
VisActor:developfrom
Jian-Zhang08:fix/gantt-sort-scales-no-scales

Conversation

@Jian-Zhang08

Copy link
Copy Markdown

🤔 This is a ...

  • Bug fix

🔗 Related issue link

Fixes #5159

💡 Background and solution

Opening Gantt with only zoomScale (no scales) threw: _sortScales() accessed timelineHeader.scales.length without a guard, and scales is undefined until the zoom scale manager populates it. Guarded with timelineHeader?.scales.

📝 Changelog

  • Guard _sortScales against undefined scales in Gantt.ts.
  • Added a unit test + changeset. (VTable gantt tests run under jest-electron/rush; test provided for CI.)

☑️ Self-Check before Merge

  • Changelog is provided

_sortScales accessed timelineHeader.scales.length without checking that
scales was defined. When only zoomScale is configured (and the zoom scale
manager has not populated scales yet), timelineHeader.scales is undefined,
so opening the Gantt threw. Guard the access with timelineHeader?.scales.

Closes VisActor#5159
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] 在使用gantt组件的时候 如果没有配置scales参数 但是配置了zoomScale参数,存在报错

1 participant