Skip to content

fix(option): avoid incorrectly requiring TimelineComponent when media is used without timeline#21694

Open
Raman-Katiyar wants to merge 1 commit into
apache:masterfrom
Raman-Katiyar:fix/timeline-component-bug
Open

fix(option): avoid incorrectly requiring TimelineComponent when media is used without timeline#21694
Raman-Katiyar wants to merge 1 commit into
apache:masterfrom
Raman-Katiyar:fix/timeline-component-bug

Conversation

@Raman-Katiyar

@Raman-Katiyar Raman-Katiyar commented Jul 16, 2026

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

It fixes a bug where TimelineComponent is incorrectly required when responsive media options are specified, even if no timeline is actually used in the chart configuration. This happens because baseOption.timeline was being assigned timelineOnRoot even when it was undefined, causing the core component loader to falsely detect timeline usage.

Fixed issues

Details

Before: What was the problem?

When developers used modular imports (without importing the TimelineComponent) alongside responsive media queries, ECharts threw the following error:
Error: Component timeline is used but not imported.

This issue occurred in OptionManager.ts. The code was assigning the value of timelineOnRoot to baseOption.timeline even when timelineOnRoot was undefined. In JavaScript, explicitly assigning undefined to an object property still registers the key on that object. Consequently, when the core component loader performed a property existence check (using in or hasOwnProperty), it detected the presence of 'timeline' on the option object and assumed a timeline was in use, resulting in an error because the component hadn't been imported.

After: How does it behave after the fixing?

With this change, baseOption.timeline is only assigned if timelineOnRoot is defined. This prevents the 'timeline' key from being incorrectly registered on the baseOption when no timeline is actively configured. As a result, responsive media queries now render successfully without triggering the incorrect TimelineComponent dependency error.

Document Info

One of the following should be checked.

  • This PR doesn't relate to document changes
  • The document should be updated later
  • The document changes have been made in apache/echarts-doc#xxx

Misc

Security Checking

  • This PR uses security-sensitive Web APIs.

ZRender Changes

  • This PR depends on ZRender changes (ecomfe/zrender#xxx).

Related test cases or examples to use the new APIs

N.A.

Merging options

  • Please squash the commits into a single one when merging.

Other information

This is a clean logical fix for the bug reported in #21686. It does not introduce any breaking changes or require modifications to the documentation. Thanks to the maintainers for reviewing!

@echarts-bot

echarts-bot Bot commented Jul 16, 2026

Copy link
Copy Markdown

Thanks for your contribution!
The community will review it ASAP. In the meanwhile, please checkout the coding standard and Wiki about How to make a pull request.

Please DO NOT commit the files in dist, i18n, and ssr/client/dist folders in a non-release pull request. These folders are for release use only.

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.

1 participant