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

   ### Summary
   
   Fixes the UX half of #43385: with ~1000 dashboards, clicking **+ Dashboard** 
shows no loading indicator and the editor only appears after a long delay, so 
the click looks dead.
   
   Root cause: the **+ Dashboard** button (Dashboards list 
`DashboardList/index.tsx` and home table `DashboardTable.tsx`) fires a hard 
`window.location.assign('/dashboard/new/')`. That GET creates the dashboard 
server-side (`Dashboard.new()` in `superset/views/dashboard/views.py`: subject 
lookups, INSERT, commit) before redirecting to the SSR editor page, and the 
click handler set no pending state — the `SubMenu` button already supports 
`loading`, it was simply never used.
   
   Fix: flip the button into its loading state before the navigation, on both 
call sites. The state lives until the page unloads, giving immediate feedback 
for the whole round-trip. No routing or backend behavior changes.
   
   For the record, the backend slowness in that issue is mostly addressed on 
master already: the list-payload perf PRs (#29121, #28609, #38567, #36246) are 
all merged, and `PUT /api/v1/dashboard/<pk>` is O(1) per dashboard. The 
reporter is on 6.1.0 without those. What remains reproducibly wrong on master 
is the missing pending state, which this PR fixes.
   
   ### Testing
   
   RED first: with the source changes stashed, the two new loading-state 
assertions fail (`2 failed, 13 passed`); with the fix:
   
   ```
   cd superset-frontend
   npx jest src/pages/DashboardList/ src/features/home/DashboardTable.test.tsx 
src/features/home/Menu.test.tsx src/features/home/RightMenu.test.tsx --silent
   Test Suites: 8 passed, 8 total
   Tests:       119 passed, 119 total
   Snapshots:   3 passed, 3 total
   ```
   
   - `DashboardList.behavior.test.tsx` — new test: clicking + Dashboard calls 
`window.location.assign('/dashboard/new/')` and the button gains 
`ant-btn-loading` (was absent before the click).
   - `DashboardTable.test.tsx` — the existing create-button test now also 
asserts the loading class appears after the click (and is absent before).
   
   `npx oxlint --config oxlint.json` on the four touched files: no new findings 
(warning count identical to master). `npm run _format -- --check`: clean.
   
   ### Additional context
   
   The existing duplicate-navigation suppression in `navigateTo` (PR #40833) is 
what makes the loading state safe to leave on: a double-click fires only one 
`assign`, and the button stays in loading state through the unload.
   
   Fixes #43385


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