rusackas commented on code in PR #44101:
URL: https://github.com/apache/superset/pull/44101#discussion_r4297834973
##########
superset-frontend/src/extensions/ExtensionContext.ts:
##########
@@ -37,10 +43,33 @@ class ExtensionContext implements ExtensionContextType {
private _storage?: ExtensionContextType['storage'];
+ private _window?: ExtensionContextType['window'];
+
constructor(extension: Extension) {
this.extension = extension;
}
+ get window(): ExtensionContextType['window'] {
+ if (!this._window) {
+ // Dispatched against the app-level `store` singleton directly, not
+ // via a `useDispatch()` hook, since this surface must also work from
+ // non-component extension code (e.g. a registered command's
+ // callback), not just from within a React render.
+ this._window = {
+ showInformationMessage: (message: string, options) => {
+ store.dispatch(addInfoToast(message, options));
Review Comment:
Good catch, fixed! It now picks `duration` out and only passes it when it is
set, so the per-severity defaults apply and `allowHtml`/`noDuplicate`/`action`
no longer leak through. Added a test for it too.
--
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]