bikash-barnwal opened a new pull request, #43177:
URL: https://github.com/apache/superset/pull/43177
### SUMMARY
The **Edit dataset** modal reached from Explore (dataset overflow menu →
*Edit dataset*) always showed an empty **Warning** field for a metric whose
warning was set, while the same modal reached from **Datasets → Edit dataset**
showed the value correctly. The value was persisted the whole time — hence the
warning icon staying put next to the metric name — it just never made it back
into the field.
The two entry points hand `DatasourceEditor` two different metric shapes:
- the dataset API returns `extra` as a JSON string;
- Explore's bootstrap payload goes through `SqlMetric.data`, which flattens
`extra` into a top-level `warning_markdown` and drops the raw `extra` string.
The editor unconditionally read the warning out of `JSON.parse(metric.extra
|| '{}')` and normalized the result with `|| ''`, so on the Explore path the
already-flattened value was overwritten with an empty string.
This extracts the transform as `hydrateMetricExtra` and treats the parsed
`extra` as authoritative only when `extra` is actually present, so an
already-flattened warning survives. An empty warning inside a present `extra`
still clears the field, so clearing a warning from the Datasets page keeps
working.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before: Warning field blank on reopen from Explore (warning icon still
shown).
After: the saved warning text is rendered in the field.
### TESTING INSTRUCTIONS
```bash
cd superset-frontend
npm run test -- src/components/Datasource
```
Manually:
1. Open a chart in Explore, click `...` beside the dataset name → **Edit
dataset**.
2. On the **Metrics** tab, expand a metric and type something into
**Warning**, then **Save**.
3. Reopen **Edit dataset** from Explore and expand the same metric — the
warning text is there.
4. Repeat from **Datasets → Edit dataset** to confirm that path is
unchanged, including clearing the warning.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #42704
- [ ] 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
🤖 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]