display empty action when invalid tag for client action

This commit is contained in:
Géry Debongnie
2019-03-06 09:56:39 +01:00
parent 859e29a7ac
commit 9dffcf4cf6
4 changed files with 54 additions and 7 deletions
@@ -117,17 +117,17 @@ export function actionManagerMixin<T extends ReturnType<typeof rpcMixin>>(
descr: ClientActionDescription
): Action["executor"] | undefined {
let key = descr.tag;
let Widget = this.actionRegistry.get(key);
if (!Widget) {
let ActionWidget = this.actionRegistry.get(key);
if (!ActionWidget) {
this.addNotification({
title: "Invalid Client Action",
type: "warning",
message: `Cannot find widget '${key}' in the action registry`
});
return;
ActionWidget = Widget;
}
return async function executor(this: Action, parent: Widget<any, any>) {
const widget = new Widget!(parent, {});
const widget = new ActionWidget!(parent, {});
const div = document.createElement("div");
await widget.mount(div);
this.widget = widget;
+1 -3
View File
@@ -24,9 +24,7 @@ export class Root extends Widget<Store, State> {
}
mounted() {
this.store.on("state_updated", this, newState => {
this.updateState(newState);
});
this.store.on("state_updated", this, this.updateState);
// loading indicator
this.store.on("rpc_status", this, status => {