rusackas opened a new pull request, #40820:
URL: https://github.com/apache/superset/pull/40820

   ### SUMMARY
   
   This is a **test-only PR** opened as a TDD-style validation of issue #33406.
   
   #33406 reports that in a Pivot Table (v2) with at least two row dimensions, 
collapsing a row group with `[-]`, scrolling so the collapsed rows leave the 
viewport, then scrolling back **re-expands** the rows. It reproduces **only 
when the dashboard is embedded via an iframe**.
   
   Root cause: the pivot renderer keeps collapse/expand state in transient 
local React state — `const [collapsedRows] = useState({})` in 
`plugin-chart-pivot-table/src/react-pivottable/TableRenderers.tsx`. Anything 
that remounts the chart (which the iframe embedding path can trigger on scroll) 
resets that state to `{}`, so the rows re-expand. The keys are stable, so this 
is a state-lifetime problem, not a key-stability one.
   
   This PR adds a Playwright spec on the **embedded** harness (the only context 
where the bug is reported) that collapses a top-level row, scrolls the embedded 
dashboard so the pivot leaves and re-enters the viewport, and asserts the row 
stays collapsed.
   
   ### How to interpret CI
   
   - **CI green** → collapse state survives the scroll round-trip; merging 
closes #33406 and guards against regressions.
   - **CI red** → the rows re-expanded; the bug is live. Fix belongs in 
`superset-frontend/plugins/plugin-chart-pivot-table` (persist collapse state 
outside transient component state).
   
   ### Verification note
   
   The embedded suite (`playwright/tests/embedded/`) runs in CI under the 
dedicated "Run Playwright (Embedded Tests)" step (`INCLUDE_EMBEDDED=true`, 
embedded SDK built, `SUPERSET_FEATURE_EMBEDDED_SUPERSET=true`). It is skipped 
when the SDK bundle is absent. I could not exercise the rendered embedded flow 
on my local dev server (its running Flask process didn't have the embedded 
feature flag enabled), so the assertion is validated by CI rather than locally 
— the harness wiring (server, guest token, iframe) follows the existing 
`embedded-dashboard.spec.ts` pattern.
   
   ### TESTING INSTRUCTIONS
   
   ```bash
   cd superset-embedded-sdk && npm ci && npm run build && cd 
../superset-frontend
   INCLUDE_EMBEDDED=true npx playwright test 
playwright/tests/embedded/pivot-collapse-state.spec.ts 
--project=chromium-embedded
   ```
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: closes #33406
   - [ ] Required feature flags:
   - [ ] Changes UI
   - [ ] Includes DB Migration
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
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]

Reply via email to