gabotorresruiz commented on code in PR #44557:
URL: https://github.com/apache/superset/pull/44557#discussion_r4087597143
##########
superset-frontend/src/dashboard/components/DashboardBuilder/DashboardContainer.tsx:
##########
@@ -304,7 +306,7 @@ const DashboardContainer: FC<DashboardContainerProps> = ({
topLevelTabs }) => {
if (dashboardInfo?.id && !dashboardLabelsColorInitiated) {
dispatch(applyDashboardLabelsColorOnLoad(dashboardInfo.metadata));
// apply labels color as dictated by stored metadata (if any)
- setDashboardLabelsColorInitiated(true);
+ setColorInitializedDashboardId(dashboardInfo.id);
Review Comment:
Not a blocker, just a note for the description: I think this line is the
load-bearing half of the fix, and the summary currently reads as if the
first-render race were the main story.
I ran both branches side by side. With `DashboardContainer` mounted and
`dashboardInfo.id` changing in place, this branch dispatches
`applyDashboardLabelsColorOnLoad` a second time with the new `label_colors`; on
`61fffbe0c0` it is never dispatched again, because
`dashboardLabelsColorInitiated` is already `true`. The effect cleanup has
meanwhile run `onBeforeUnload`, which calls `resetColors()` on the namespace,
so on master the second dashboard keeps palette colors for the rest of the
session until a full reload. That matches the reporter's `After refreshing or
clicking legend, the colors become correct` in #40708, and
`src/pages/Dashboard/index.tsx:25` renders `DashboardPage` with no `key`, so
in-app navigation really does swap `dashboardInfo.id` under a mounted container.
For the first-render half I could not build a cold-load repro:
`hydrate.ts:174` seeds every chart from the initial `chart` state with
`queriesResponse: null`, and `DashboardPage.tsx:423` only mounts the container
once `dashboardInfo` is populated, so no chart owns a query response at that
first commit on a fresh page load. Am I missing a path there? Either way,
calling the navigation case out in the description would make this easier to
justify.
--
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]