antvis / S2

⚡️ A practical visualization library for tabular analysis.
https://s2.antv.antgroup.com
MIT License
1.49k stars 197 forks source link

fix: 修复通过修改引用的方式修改菜单配置时, tooltip 未重新渲染 #2933

Closed lijinke666 closed 1 month ago

lijinke666 commented 1 month ago

👀 PR includes

🐛 Bugfix

📝 Description

    const operator = {
      menu: {
        items: [
          {
            key: 'menu-a',
            label: <div className="menu-a-text">menu-a-text</div>,
          },
        ],
      },
    };

    await s2.showTooltip({
      position: { x: 0, y: 0 },
      options: {
        operator,
      },
    });

    await sleep(1000);

    // 通过修改引用, 重新赋值的方式, 无法触发组件层的 rerender
    operator.menu!.items = [
      ...operator.menu!.items!,
      {
        key: 'menu-b',
        label: <div className="menu-b-text">menu-b-text</div>,
      },
    ];

    await s2.showTooltip({
      position: { x: 0, y: 0 },
      options: {
        operator,
      },
    });

🖼️ Screenshot

Before After

🔗 Related issue link

🔍 Self-Check before the merge

vercel[bot] commented 1 month ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
antvis-s2 ❌ Failed (Inspect) Oct 25, 2024 7:57am
github-actions[bot] commented 1 month ago

Size Change: +1 B (0%)

Total Size: 335 kB

Filename Size Change
./packages/s2-react/dist/index.min.js 70.9 kB +1 B (0%)
ℹ️ View Unchanged | Filename | Size | | :--- | :---: | | `./packages/s2-core/dist/index.min.js` | 236 kB | | `./packages/s2-core/dist/style.min.css` | 388 B | | `./packages/s2-react/dist/style.min.css` | 3.77 kB | | `./packages/s2-vue/dist/index.min.js` | 22.9 kB | | `./packages/s2-vue/dist/style.min.css` | 1.85 kB |

compressed-size-action

lijinke666 commented 1 month ago

:tada: This PR is included in version @antv/s2-react-v2.0.0-next.29 :tada:

The release is available on:

Your semantic-release bot :package::rocket: