Skip to content

fix(core): reset process flag on option error. close #15037#21670

Open
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-15037-calendar-setoption-recovery
Open

fix(core): reset process flag on option error. close #15037#21670
rahul37wallst-sudo wants to merge 1 commit into
apache:masterfrom
rahul37wallst-sudo:investigate-15037-calendar-setoption-recovery

Conversation

@rahul37wallst-sudo

Copy link
Copy Markdown

Brief Information

This pull request is in the type of:

  • bug fixing
  • new feature
  • others

What does this PR do?

Reset the ECharts main-process state when setOption fails during option merge so the same chart instance can recover on later valid setOption calls.

Fixed issues

Details

Before: What was the problem?

If setOption threw while merging options, ECharts had already entered the main process state but did not reset that state before rethrowing.

After that, later valid setOption calls on the same chart instance could be blocked with:

[ECharts] `setOption` should not be called during main process.

This affected the reported calendar case where an invalid intermediate calendar.range value could poison the chart instance and prevent recovery.

After: How does it behave after the fixing?

setOption now resets the pending update and main-process flags when option merge throws, then rethrows the original error.

This keeps the original error behavior for invalid options, but allows the same chart instance to accept a later valid setOption.

Regression tests were added for:

  • recovery after an invalid calendar option;
  • recovery after an option merge error caused by duplicate component ids.

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

test/ut/spec/api/setOption.test.ts

Merging options

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

Other information

Validation run locally:

npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/api/setOption.test.ts
npx jest --config test/ut/jest.config.cjs --coverage=false --runInBand --runTestsByPath test/ut/spec/model/Global.test.ts
npm run checktype
npm run lint
git diff --check

@echarts-bot

echarts-bot Bot commented Jul 2, 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