fix(dashboard): avoid render PanelVizAddons in ClientPanelRender #1616
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
开发者在使用 PanelAddon 时,可能会用 ClientPanelRender 在 Panel 的逻辑树内部渲染当前 Panel,这就有可能造成递归的渲染。之前采取了一些措施来避免这种情况:
table/dashboard/src/components/panel/panel-render/panel-render-base.tsx
Line 26 in 2cb3da9
但是这里的处理不够彻底,因为在逻辑树上递归渲染的缘故,里层的 PanelVizAddons 组件可能会将 Addon 挂载到顶层的普通 Panel 上。
现在 PanelVizAddons 组件会检查当前的
withAddon
状态(ClientPanelRender 会将其设置为 false),从而避免递归渲染 Addon。