mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
fix issue with actioncontainer, add tests
This commit is contained in:
@@ -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";
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user