sadpandajoe opened a new pull request, #45298: URL: https://github.com/apache/superset/pull/45298
### SUMMARY In edit mode, **Edit properties** can show a Description that is not the dashboard's saved description, and saving the dashboard then writes that value back: - after setting a description on dashboard A in edit mode and opening dashboard B (which has none), B's properties modal shows A's description, and applying/saving persists it onto B; - after changing a dashboard's description from the Dashboards list, the dashboard's properties modal still shows the older value set in edit mode, and the next save reverts the list edit. On a fresh page load the field also comes up empty for a dashboard that has a description, and because the save payload reads the same value, a save can send `description: null`. ### Root Cause `useDashboard` requests `/api/v1/dashboard/<id>` with an explicit `columns` list (`DASHBOARD_GET_COLUMNS`), and the endpoint only returns the requested fields. `description` was not in that list (it was added to the properties modal and the save payload after the list was introduced), so the payload handed to `hydrateDashboard` never contained it. The `HYDRATE_DASHBOARD` reducer merges the incoming `dashboardInfo` over the existing state, so an absent key keeps whatever the previous dashboard (or the last **Apply** in the modal) left there. Both the properties modal (which seeds from `dashboardInfo`) and the save payload read that value, so they showed and persisted the stale one. The Dashboards list modal fetches the record without a `columns` list, which is why it was always correct. ### The fix - `hooks/apiResources/dashboards.ts`: add `description` to `DASHBOARD_GET_COLUMNS`, so hydration always carries the saved description (including an explicit `null`), replacing any previous dashboard's value. - Types: `Dashboard`, `DashboardInfo` and the Header's local state types now declare `description?: string | null`, since the field can be `null`. No runtime change. Alternatives considered: always refetching in the properties modal (fixes the display but not the save payload, and races with unsaved Apply-only edits), and resetting `description` in the reducer when absent (treats the symptom one layer too late). ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF Before/after recordings follow in a separate update to this description. In words: before, opening **Edit properties** on a dashboard shows a different dashboard's description (or an empty/older one); after, it shows that dashboard's saved description. ### TESTING INSTRUCTIONS ```bash cd superset-frontend npx jest src/hooks/apiResources/dashboards.test.ts -t "saved description" ``` The new test emulates the endpoint honoring the requested `columns` and asserts `useDashboard` returns the saved description of each dashboard, including an explicit `null`. Before the change it fails because the response has no `description` key. Manual check: create dashboards A and B with no description; on A, **Edit dashboard > Edit properties**, set a description, **Apply** and **Save**. Open B and **Edit dashboard > Edit properties**: Description should be empty. Then change a dashboard's description from **Dashboards > Actions > Edit**, reopen it and check **Edit properties** shows the new value. ### ADDITIONAL INFORMATION - [ ] 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 -- 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]
