react-echarts icon indicating copy to clipboard operation
react-echarts copied to clipboard

State change causes chart not to render initially

Open timbarclay opened this issue 1 year ago • 1 comments

Description

If state is updated in useEffect, the initial render of the chart fails to happen.

Link to Reproduction

https://stackblitz.com/edit/stackblitz-starters-21kxf1?file=app%2Fpage.tsx

Steps to reproduce

  1. Go to https://stackblitz.com/edit/stackblitz-starters-21kxf1?file=app%2Fpage.tsx
  2. Click on "Show chart"
  3. Note that no chart appears
  4. If you toggle "Show chart" off and on again it does show

If you comment out the useEffect call, the issue does not happen.

JS Framework

Nextjs (TS)

Version

1.4.0

Browser

Chrome 131

Operating System

  • [ ] macOS
  • [X] Windows
  • [ ] Linux

Additional Information

This may be related to https://github.com/hugocxl/react-echarts/issues/37 since that error is logged in the console, but this seems like a more serious because it prevents the chart appearing at all to begin with.

timbarclay avatar Nov 26 '24 12:11 timbarclay

Same thing here.

sergioisidoro avatar Dec 01 '24 11:12 sergioisidoro