michael-s-molina commented on PR #40915:
URL: https://github.com/apache/superset/pull/40915#issuecomment-4673573512

   > Nice improvement. One question: should the corresponding editor 
functionality be refactored to be in line with these new hooks?
   
   @villebro Thank you so much for this comment! It was the trigger for a 
better design that I implemented in 
[e1ac0a4](https://github.com/apache/superset/pull/40915/commits/e1ac0a4285739ce2ad01ad58bc0ea030ee089e7a).
   
   To improve consistency, I added a `useEditor(language)` hook for editors 
(mirroring the `useViews`/`useMenu` hooks introduced in this PR) and exposed 
`onDidRegisterView`/`onDidUnregisterView` and 
`onDidRegisterMenuItem`/`onDidUnregisterMenuItem` events for views and menus 
(mirroring the `onDidRegisterEditor`/`onDidUnregisterEditor` events that 
already existed for editors). The `EditorHost` component was simplified as a 
result — the manual useEffect-based subscription loop with its mount race 
workaround and suppressed  lint warning was replaced by a clean 
`useSyncExternalStore` call, the same pattern now used uniformly across all 
three registries.


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