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

   ### SUMMARY
   
   Optimized `TimezoneSelector` to fix a ~550ms delay when opening the Schedule 
panel in the Alert creation modal. Timezone data now loads on demand when the 
user opens the dropdown, with a loading indicator.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   ## Before
   
https://github.com/user-attachments/assets/712abe50-973a-403e-8141-9096554fefd7
   
   ## After
   
https://github.com/user-attachments/assets/b22d86bf-efea-42ce-afcf-fccd9a432c0a
   
   
   ### TESTING INSTRUCTIONS
   1. Create an alert or report.
   2. Click to open the Schedule section of the modal.
   
   ### Details on the refactor
   ### Performance
   - Lazy loading: timezone options load only when the dropdown opens (via 
`onOpenChange`)
   - Async computation: uses `queueMicrotask`/`setTimeout(0)` to avoid blocking 
the main thread
   - Global caching: computed options are cached for subsequent renders
   
   ### UX
   - Loading indicator: shows spinner and "Loading timezones..." while data 
loads
   - Dropdown stability: added `minHeight: 265px` to prevent repositioning 
after data loads
   - Conditional value: only sets the selected value after options are loaded
   
   ### Code quality
   - Extracted helper functions (`getOffsetKey`, `getTimezoneDisplayName`, 
`findMatchingTimezone`)
   - Reorganized file structure: types → constants → helpers → component
   - Removed code duplication and improved readability
   
   ### Testing
   - Updated tests to handle async loading behavior
   - Fixed DST test to correctly verify timezone formatting
   
   ## Impact
   - Schedule panel opens instantly (0ms delay)
   - Timezone dropdown shows loading state during computation (~150ms, only on 
first open)
   - Subsequent opens are instant (cached)
   - No functionality changes, only performance improvements
   
   ### ADDITIONAL INFORMATION
   <!--- Check any relevant boxes with "x" -->
   <!--- HINT: Include "Fixes #nnn" if you are fixing an existing issue -->
   - [x] 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