fix issue with actioncontainer, add tests

This commit is contained in:
Géry Debongnie
2019-02-06 13:26:21 +01:00
parent 7aa252c222
commit 91e51b2798
9 changed files with 198 additions and 34 deletions
+1 -2
View File
@@ -286,9 +286,8 @@ export class PureComponent<T extends WEnv, Props, State> extends Component<
async updateState(nextState: Partial<State>) {
for (let k in nextState) {
if (nextState[k] !== this.state[k]) {
return;
return super.updateState(nextState);
}
}
return super.updateState(nextState);
}
}
@@ -59,7 +59,6 @@ export class ActionManager extends EventBus implements IActionManager {
}
doAction(request: ActionRequest) {
console.log("doaction", request);
if (typeof request === "number") {
// this is an action ID
let name = request === 131 ? "discuss" : "crm";
+12 -1
View File
@@ -17,6 +17,17 @@ export class ActionContainer extends Widget<Props, {}> {
template = "web.action_container";
currentWidget: any;
willStart() {
return this.setContentWidget();
}
mounted() {
if (this.currentWidget && this.currentWidget.el) {
this.el!.appendChild(this.currentWidget.el);
this.currentWidget.__mount();
}
}
shouldUpdate(nextProps: Props) {
if (nextProps.stack !== this.props.stack) {
this.props = nextProps;
@@ -30,7 +41,7 @@ export class ActionContainer extends Widget<Props, {}> {
if (info && info.type === "client") {
const Widget = info.Widget;
let widget = new Widget(this, {});
await widget.mount(this.el!);
await widget.mount(this.el || document.createElement("div"));
if (this.currentWidget) {
this.currentWidget.destroy();
}