mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
work on navbar
This commit is contained in:
@@ -2,3 +2,23 @@ import { BaseWidget } from "../core/base_widget";
|
||||
import { Env } from "../env";
|
||||
|
||||
export class Widget<Props, State> extends BaseWidget<Env, Props, State> {}
|
||||
|
||||
// TODO: move this to PureComponent in core
|
||||
export class PureWidget<Props, State> extends Widget<Props, State> {
|
||||
shouldUpdate(nextProps: Props): boolean {
|
||||
for (let k in nextProps) {
|
||||
if (nextProps[k] !== this.props[k]) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
async updateState(nextState: Partial<State>) {
|
||||
for (let k in nextState) {
|
||||
if (nextState[k] !== this.state[k]) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
return super.updateState(nextState);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user