Skip to content

Fix/pr 5202 gantt zoomscale review#5220

Merged
fangsmile merged 4 commits into
developfrom
fix/pr-5202-gantt-zoomscale-review
Jul 15, 2026
Merged

Fix/pr 5202 gantt zoomscale review#5220
fangsmile merged 4 commits into
developfrom
fix/pr-5202-gantt-zoomscale-review

Conversation

@fangsmile

@fangsmile fangsmile commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

🤔 This is a ...

  • Bug fix
  • Test Case
  • Changelog

🔗 Related issue link

fix #5159

💡 Background and solution

When Gantt is configured with timelineHeader.zoomScale but without timelineHeader.scales, _sortScales could access missing scales and crash during initialization. The fix now initializes timeline scales from the configured scales, the active zoomScale level, or a safe default day scale.

This PR also avoids sharing the mutable default scale object across calls, preventing generated timelineDates from leaking between Gantt instances.

📝 Changelog

Language Changelog
🇺🇸 English Fix Gantt initialization when zoomScale is configured without timelineHeader.scales, using the active zoom level or a safe default timeline scale.
🇨🇳 Chinese 修复 Gantt 配置 zoomScale 但未配置 timelineHeader.scales 时的初始化异常,并使用当前缩放层级或安全默认时间刻度完成初始化。

☑️ Self-Check before Merge

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

🚀 Summary

copilot:summary

🔍 Walkthrough

copilot:walkthrough

Jian-Zhang08 and others added 3 commits June 26, 2026 00:30
_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 #5159
@fangsmile fangsmile merged commit d88b881 into develop Jul 15, 2026
7 of 8 checks passed
@fangsmile fangsmile deleted the fix/pr-5202-gantt-zoomscale-review branch July 15, 2026 06:14
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参数,存在报错

2 participants