alibaba / BizCharts

Powerful data visualization library based on G2 and React.
http://bizcharts.net/products/bizCharts
6.17k stars 671 forks source link

react18 严格模式下, 切换 图表类型 不渲染 #1546

Open vaynevayne opened 1 year ago

vaynevayne commented 1 year ago
  {_value.geomType === 'line' ? (
          <>
            line
            <Chart
              key={'line'}

              autoFit
              height={250}
              data={chartData}
            >

              <Line position={`${_value.x}*${_value.y}`} color={_value.z} />
            </Chart>
          </>
        ) : null}
        {_value.geomType === 'interval' ? (
          <>
            interval
            <Chart
              key={'interval'}

              autoFit
              height={250}
              data={chartData || []}
            >
              <Interval />
            </Chart>
          </>
        ) : null}

放在 dom里的line 和 interval 字符串都切换渲染了,但是图表切换时,会显示

image
vaynevayne commented 1 year ago

https://developer.aliyun.com/article/1167184 已解决, 怀疑是严格模式下 dom 节点没删除导致的