SIGN IN SIGN UP
apache / superset UNCLAIMED

Apache Superset is a Data Visualization and Data Exploration Platform

0 0 151 TypeScript

fix(ChartRenderer): address review on class→function refactor

Per @Copilot's review on #39459:

1. **showContextMenu staleness.** Moved out of `useState` (where it was
   computed once at initializer time and would go stale on source / viz-
   type changes for the same mounted instance) into a `useMemo` derived
   from props + feature flags. Renames `state.showContextMenu` to plain
   `showContextMenu` at all four call sites. Matches the pre-refactor
   semantic of recomputing on every render.

2. **cloneDeep runs during loading.** Gated the deep clone of
   `queriesResponse` on `resultsReady` so it only runs when results are
   about to render. Previously it ran on every `queriesResponse`
   identity change including loading/idle transitions.

Not changed in this commit (responses to come in separate replies):
- Chart.tsx prop spreading change — needs an audit of `ChartProps`
  surface to confirm nothing dropped silently.
- `memo()` vs custom `shouldComponentUpdate` — would need a tailored
  `areEqual` to faithfully port the old SCU; deferring as a follow-up
  since the default-memo behavior is the more idiomatic React 18+ shape.
- Test cast `props as ChartRendererProps` — fixture re-typing is a
  test-cleanup pass that's out of scope here.
C
Claude Code committed
664a891f8484f8ec593cd03b3fe20155be05a8cc
Parent: 7bd107f