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

   ### SUMMARY
   
   #### Root Cause
   
   The error `Cannot read properties of undefined (reading 'resize')` was 
introduced in commit `6cb3cea960` ("feat(extensions): Allow replacing editors 
using extensions (#37499)" - January 29, 2026).
   
   This commit introduced `EditorHost` - an abstraction layer that allows 
extensions to replace the default Ace editor with alternatives (Monaco, 
CodeMirror, etc.). The `SQLEditorWithValidation` component was refactored to 
use this new abstraction, but the `AdhocFilterEditPopoverSqlTabContent` 
component still attempted to call `aceEditorRef?.current?.editor.resize()` 
directly on the Ace editor instance. Since the ref now points to an 
`EditorHandle` interface (not the raw Ace editor), and `EditorHandle` doesn't 
expose an `.editor` property, the code crashes.
   
   #### Possible Solutions
   
   1. **Remove resize** — Delete the broken code and rely on declarative 
height/width props for sizing. Simplest fix but may lose resize functionality 
in edge cases (hidden tabs becoming visible).
   2. **Optional `resize?()`** — Add `resize?(): void` as an optional method to 
`EditorHandle`. Ace implements it, other editors can skip it. Preserves 
functionality but requires optional chaining (`?.resize?.()`) and the contract 
is unclear.
   3. **Required `resize()` with editor-specific mapping** — Add `resize(): 
void` as a required method. Each editor maps to their equivalent 
(Ace→`resize()`, Monaco→`layout()`, CodeMirror→`refresh()`). Clear contract but 
forces all editors to implement it.
   
   #### Solution Chosen
   
   **Option 2: Optional `resize?()` method** with the intent to keep the 
abstraction clean while preserving Ace's resize capability.
   
   - Added `resize?(): void` to the `EditorHandle` interface in `editors.ts`
   - Implemented `resize` in `AceEditorProvider` that calls `editor.resize()`
   - Updated `AdhocFilterEditPopoverSqlTabContent` to use 
`editorRef.current?.resize?.()`
   - Added test to verify resize is called when the filter changes
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   <!--- Skip this if not applicable -->
   
   ### TESTING INSTRUCTIONS
   <!--- Required! What steps can be taken to manually verify the changes? -->
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [ ] Has associated issue:
   - [ ] Required feature flags:
   - [ ] 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