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

   ### SUMMARY
   
   Editing an existing metric or calculated column and immediately adding 
another item can make the new row disappear when the earlier debounced edit 
commits. The stale callback rebuilds the collection from an outdated snapshot, 
and the save payload can lose the new item too.
   
   Apply field edits to the latest ordered collection, advance that collection 
before notifying the parent, and ignore delayed edits to deleted rows. Keep 
expanded-field callbacks stable per row so SQL editors retain pending edits 
across expansion and collection changes. Regression tests cover collection 
membership, batched edits, real Ace SQL edits, and the saved 
metric/calculated-column payloads.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   No visual layout changes.
   
   - **Before:** an immediate Add can be undone by a pending text edit, and 
pending SQL edits can be canceled by collection changes.
   - **After:** added rows and pending field edits remain in the collection and 
save payload; delayed callbacks cannot restore deleted rows.
   
   ### TESTING INSTRUCTIONS
   
   1. Open **Edit Dataset** for a dataset with an existing metric and 
calculated column.
   2. In **Metrics**, expand an existing row, edit its description and SQL 
expression, then immediately click **Add item** before the debounce completes.
   3. Verify the new row remains and the existing row retains both edits. Give 
the new row a valid name and SQL expression.
   4. Edit a SQL expression and expand another row within 300 ms. Verify the 
expression is retained after the debounce completes.
   5. Repeat in **Calculated columns**, then **Save** and **Confirm**. Reopen 
the dataset and verify the new items and edited values.
   
   Automated validation:
   
   - 78 tests passed across eight suites covering CollectionTable, 
DatasourceModal, DatasourceEditor, metric certification, and TextAreaControl, 
using workspace-local package source mappings.
   - The new real-Ace SQL regression cases failed before the stable-callback 
fix and passed afterward.
   - Staged `pre-commit run` passed, including frontend TypeScript, formatting, 
and lint checks.
   
   To run the new regression suites from `superset-frontend`:
   
   ```sh
   npm run test -- --runTestsByPath \
     
src/components/Datasource/components/CollectionTable/CollectionTable.debounce.test.tsx
 \
     
src/components/Datasource/DatasourceModal/DatasourceModal.pendingEdits.test.tsx
   ```
   
   Live-server verification has not been performed. The exact reported 6.1 
build is unavailable; the persisted-but-hidden behavior described in the 
associated story has not been separately reproduced.
   
   ### ADDITIONAL INFORMATION
   
   - [x] Has associated issue: 
[sc-124649](https://app.shortcut.com/preset/story/124649)
   - [ ] 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]

Reply via email to