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

   ### Summary
   
   When creating a **new (unsaved) chart** and clicking Save, the dialog 
defaulted to **Overwrite** mode. Since no chart existed yet, overwriting 
failed. Users had to manually switch to **Save As**.
   
   **Root cause:** `canOverwriteSlice()` in `SaveModal.tsx` returned `true` for 
new charts when `can_overwrite=true` or the user was an admin, because those 
permission checks short-circuited before checking whether a `slice` even exists.
   
   **Fix:** Added `!!this.props.slice &&` as the first guard in 
`canOverwriteSlice()`, so Overwrite is only enabled (and never pre-selected) 
when an existing chart is loaded.
   
   ### Testing
   
   - Added unit test: `'defaults to Save As for new chart even when 
can_overwrite is true'` — verifies that with `slice: null` and `can_overwrite: 
true`, the Overwrite radio is disabled and Save As is checked.
   - All pre-commit hooks pass (end-of-file, prettier, oxlint, trim whitespace).
   
   ### Checklist
   
   - [x] Unit test added
   - [x] Pre-commit clean
   - [x] Changelog entry not required (bug fix in UI only)


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