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

   <!---
   Please write the PR title following the conventions at 
https://www.conventionalcommits.org/en/v1.0.0/
   Example:
   fix(dashboard): load charts correctly
   -->
   
   ### SUMMARY
    Fixes a bug where the theme object from the `withTheme()` HOC was 
incorrectly passed to the `TextAreaEditor` component, causing prop type errors 
and failed module loading attempts.
   
    The `TextAreaControl` component is wrapped with the `withTheme()` HOC which 
injects a theme object containing style tokens (e.g., `{colorBorder, 
colorBgMask, sizeUnit}`). Previously, the component used `{...this.props}` to 
spread all props to the `TextAreaEditor` component, including this theme object.
   
     However, `TextAreaEditor` (which wraps `AsyncAceEditor`) expects the 
`theme` prop to be a string like `'github'` or `'textmate'` that specifies 
which ace editor theme to load. When the theme object was passed instead, it 
was stringified to `[object Object]` in the dynamic import path, causing a 404 
error.
   
     **The Fix:**
     Destructure and exclude incompatible props before spreading to 
`TextAreaEditor`:
     - `theme` - Theme object from HOC (incompatible with ReactAce's string 
theme prop)
     - `height` - Number value (ReactAce expects string)
     - Other TextAreaControl-specific props that ReactAce doesn't recognize
   
     The theme object is still used by TextAreaControl for its own styling 
needs, but is no longer passed down to the editor component.
   
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   Before - 
   When opening forms with TextAreaControl components (e.g., datasource modal 
metrics tab), the following issues occurred:
     - React prop type warning: `Invalid prop 'theme' of type 'object' supplied 
to ReactAce, expected 'string'`
     - Network error: `GET 
http://localhost:9000/static/assets/theme-[object%20Object].js 404 (Not Found)`
     - Additional prop type warnings for `height` prop
   <img width="1701" height="598" alt="image" 
src="https://github.com/user-attachments/assets/db748a58-1c62-4d71-aacf-57087a7f0245";
 />
   
   After - 
    - No more prop type warnings
     - No more failed network requests for `theme-[object Object].js`
     - TextAreaEditor receives only compatible props
   <img width="1704" height="667" alt="image" 
src="https://github.com/user-attachments/assets/d4d0f393-6a68-4ed3-b043-4ad673c80297";
 />
   
   
   ### 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://gith
   <img width="604" height="46" alt="Screenshot 2025-11-08 at 12 25 11 PM" 
src="https://github.com/user-attachments/assets/213cf4e1-b0b6-4ad7-9419-90b160071af8";
 />
   ub.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