sadpandajoe opened a new pull request, #42075:
URL: https://github.com/apache/superset/pull/42075
### SUMMARY
On a fresh tabbed dashboard load (no permalink, no stored dashboard state, no
direct-link path), `dashboardState.activeTabs` resolved to `[]` until the
`Tabs`
grid component dispatched `setActiveTab` on a post-mount effect. Any
first-render
consumer of `activeTabs` (native filter scoping, share/permalink payloads,
screenshot capture) read that stale empty array. The most visible symptom was
broken filter-bar scoping on embedded dashboards with tabs, which #39417
patched
locally inside `useActiveDashboardTabs` for that one consumer only.
This change moves the default-path derivation to where the value first enters
Redux:
- Extracts the `ROOT -> first TABS -> first TAB` default-path walk
(recursing into
nested `TABS` containers) into a shared, cycle-safe helper,
`getDefaultActiveTabs`.
- Seeds that value at hydration time so Redux is correct from render 0, for
every
consumer rather than just the filter bar.
- Preserves the existing precedence: a permalink `activeTabs` param wins,
then a
non-empty stored Redux value, then the layout default. Seeding is gated off
whenever a direct-link path is present, so it cannot fight a deep link.
- Reverts `useActiveDashboardTabs` (in `components/nativeFilters/state.ts`),
which
#39417 had made reconstruct the default path from the layout on every
read, back
to a plain Redux read now that hydration seeds the value directly. This
makes
Redux the single source of truth. Its defensive null-guards for a partial
or
undefined store are retained.
Follow-up to #39417 and #41832.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Not applicable as a visual before/after, and included here as an explicit
note so
reviewers are not left looking for one. `master` already carries the #39417
filter-bar band-aid, so the live filter-bar output is identical on `master`
and on
this branch for the one consumer #39417 fixed. A filter-bar before/after
would look
the same on both and would misrepresent the change.
The authoritative render-0 evidence is the new `hydrate.test.ts` assertion,
which
verifies the `HYDRATE_DASHBOARD` payload seeds the default tab path and is
RED
against `master`'s `[]`. The change's distinct, non-filter-bar wins (correct
`activeTabs` in share/permalink payloads and in Redux from render 0, with
deep-link
precedence preserved) were verified in an independent browser QA pass (see
testing
instructions).
### TESTING INSTRUCTIONS
Automated: `getDefaultActiveTabs.test.ts`, `hydrate.test.ts`,
`state.test.ts`, and
`reducers/dashboardState.test.ts` (69 assertions across the four suites)
pass; the
`hydrate.test.ts` seeding cases are RED without the fix.
Manual (independent environment QA, all PASS at this HEAD):
1. Open a fresh embedded tabbed dashboard with `?uiConfig=2` and per-tab
filter
scoping. On first paint the filter bar scopes to the default tab, and
Redux
`dashboardState.activeTabs` is non-empty (the default tab id).
2. On that fresh default load, use "Copy permalink to clipboard". The emitted
payload carries the seeded default `activeTabs`, confirming a
non-filter-bar
consumer reads the correct value.
3. Deep-link (permalink) to a non-default tab and open fresh. That tab wins
and is
not clobbered by the default seed; the filter bar scopes to the
deep-linked tab.
4. Regression sweep: empty-filter tabbed dashboard renders clean with no
error
boundary; 375x812 mobile viewport and dark theme both preserve correct
scoping
and a non-empty Redux value.
### ADDITIONAL INFORMATION
<!--- Check any relevant boxes with "x" -->
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
Reviewer notes (known, non-blocking):
- A deep-link load (`directPathToChild` present) still seeds `activeTabs:
[]` at
hydration, so anchored/embedded deep-links remain one paint late. This
matches
current `master` behavior and is not a regression; a follow-up could seed
the
ancestor path from `directPathToChild`.
- The permalink `[]` case intentionally wins over the layout default (an
explicit
empty selection is honored); a pinning test guards this.
- `getDefaultActiveTabs` keeps a redundant enqueue-time visited guard
alongside the
dequeue-time one; it is harmless and left for readability.
--
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]