marunrun commented on code in PR #35208:
URL: https://github.com/apache/superset/pull/35208#discussion_r3472617519
##########
superset-frontend/src/dashboard/components/gridComponents/Chart/Chart.tsx:
##########
@@ -705,6 +705,18 @@ const Chart = (props: ChartProps) => {
height={getHeaderHeight()}
exportPivotExcel={exportPivotExcel as unknown as (arg0: string) =>
void}
chartHolderRef={props.chartHolderRef}
+ ownState={createOwnStateWithChartState(
+ (dataMask[props.id]?.ownState as JsonObject) || EMPTY_OBJECT,
+ {
+ state:
+ getChartStateWithFallback(
+ chartState as { state?: JsonObject } | undefined,
+ formData as JsonObject,
+ slice.viz_type,
+ ) ?? undefined,
+ },
+ slice.viz_type,
+ )}
Review Comment:
Valid point, and this one I did introduce — fixed in c8da7e6e81. The
`ownState` computation (`createOwnStateWithChartState`) is now wrapped in
`useMemo` keyed on `[dataMaskOwnState, chartState, formData, sliceVizType]`, so
it holds a stable reference across re-renders that don't change its logical
value. Both `ownState={...}` call sites in `Chart.tsx` now consume that
memoized value, so `ViewQueryModal` only refetches on real state changes.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]