mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] observer: notify subscribers directly
This rev. moves the logic of batching the notifications of changes occurring in the same microtask tick, from the observer, to the listeners (the context, and the render function of components). By doing so in render, we ensure that similar renderings are batched in a single one, wherever they come from (state change, store change, direct call...).
This commit is contained in:
@@ -3400,10 +3400,6 @@ describe("async rendering", () => {
|
||||
});
|
||||
|
||||
test("change state and call manually render: no unnecessary rendering", async () => {
|
||||
// when the state is changed, the component isn't notified directly (we wait
|
||||
// for a microtask tick before calling 'render'), so it may happen that
|
||||
// another rendering is done meanwhile, already using the new value of the
|
||||
// state
|
||||
class Widget extends Component<any, any> {
|
||||
static template = xml`<div><t t-esc="state.val"/></div>`;
|
||||
state = useState({ val: 1 });
|
||||
|
||||
Reference in New Issue
Block a user