mikebridge commented on code in PR #45052:
URL: https://github.com/apache/superset/pull/45052#discussion_r4224617572
##########
superset-frontend/src/dashboard/reducers/dashboardInfo.ts:
##########
@@ -218,6 +350,40 @@ export default function dashboardInfoReducer(
return {
...state,
...action.data.dashboardInfo,
+ semanticDatasets:
+ state.semanticDatasets?.dashboardId === action.data.dashboardInfo.id
+ ? state.semanticDatasets
+ : null,
+ semanticDatasetsRequestId:
+ state.id === action.data.dashboardInfo.id ||
+ state.semanticDatasets?.dashboardId === action.data.dashboardInfo.id
+ ? state.semanticDatasetsRequestId
+ : undefined,
+ semanticDatasetRequests:
+ state.id === action.data.dashboardInfo.id ||
+ state.semanticDatasets?.dashboardId === action.data.dashboardInfo.id
+ ? state.semanticDatasetRequests
+ : {},
Review Comment:
Addressed in `79f15510bd`: hydration clears the per-source add request map
even when the dashboard id matches, so a pre-remount response arriving
afterward is rejected. Red-first regressions cover both page/add completion
orders after hydration and confirm that fresh temporal metadata wins. There is
still a nonblocking edge where page metadata arrives before hydration and stays
unproven until another refresh; that retains the saved grain, and I have
recorded it for a focused lifecycle follow-up.
##########
superset-frontend/src/dashboard/actions/dashboardInfo.ts:
##########
@@ -46,6 +50,94 @@ export function dashboardSaveSucceeded(dashboardId: number) {
export const DASHBOARD_INFO_UPDATED = 'DASHBOARD_INFO_UPDATED';
export const DASHBOARD_INFO_FILTERS_CHANGED = 'DASHBOARD_INFO_FILTERS_CHANGED';
+export const REPLACE_DASHBOARD_SEMANTIC_DATASETS =
+ 'REPLACE_DASHBOARD_SEMANTIC_DATASETS';
+export const UPDATE_DASHBOARD_SEMANTIC_DATASET =
+ 'UPDATE_DASHBOARD_SEMANTIC_DATASET';
+
+type SemanticDataset = NonNullable<
+ DashboardInfo['semanticDatasets']
+>['datasets'][number];
+
+export function provenSemanticDataset(
+ value: unknown,
+ sourceKey: string,
+): SemanticDataset | null {
+ if (!value || typeof value !== 'object') return null;
+ const candidate = value as Partial<SemanticDataset> & { id?: number };
+ const sourceId = /^([1-9]\d*)__semantic_view$/.exec(sourceKey)?.[1];
Review Comment:
Addressed in `79f15510bd`: the hoisted source-key regexp uses
`DatasourceType.SemanticView`, keeping one source of truth and preserving the
existing positive-integer key format. The focused metadata-fetch regressions
pass.
##########
superset-frontend/src/dashboard/reducers/dashboardInfo.ts:
##########
@@ -126,6 +139,125 @@ export default function dashboardInfoReducer(
action: DashboardInfoReducerAction,
): DashboardInfoState {
switch (action.type) {
+ case REPLACE_DASHBOARD_SEMANTIC_DATASETS: {
+ const {
+ dashboardId,
+ datasets,
+ requestId,
+ isRefreshStart,
+ expectedGeneration,
+ } = action as DashboardInfoAction;
+ if (
+ dashboardId === undefined ||
+ (state.id !== undefined && dashboardId !== state.id)
Review Comment:
Addressed in `79f15510bd`: REPLACE requires the same exact dashboard-id
match as UPDATE. The page effect already waits for the hydrated dashboard id,
so the looser guard was not needed for initial loading. A red-first test pins
rejection before hydration, and the existing first-load/navigation page tests
pass.
--
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]