[FIX] useEffect: can depend on dom dependencies

Because the dependencies are now computed in patched.
This commit is contained in:
Géry Debongnie
2021-12-21 16:36:36 +01:00
committed by Aaron Bohy
parent 3c98ef8cb1
commit bd5637c0a3
3 changed files with 57 additions and 14 deletions
@@ -197,6 +197,25 @@ exports[`hooks useEffect hook dependencies prevent effects from rerunning when u
}"
`;
exports[`hooks useEffect hook effect can depend on stuff in dom 1`] = `
"function anonymous(bdom, helpers
) {
let { text, createBlock, list, multi, html, toggler, component, comment } = bdom;
let block2 = createBlock(\`<div block-ref=\\"0\\"/>\`);
return function template(ctx, node, key = \\"\\") {
const refs = ctx.__owl__.refs;
let b2;
if (ctx['state'].value) {
let d1 = (el) => refs[\`div\`] = el;
b2 = block2([d1]);
}
return multi([b2]);
}
}"
`;
exports[`hooks useEffect hook effect runs on mount, is reapplied on patch, and is cleaned up on unmount and before reapplying 1`] = `
"function anonymous(bdom, helpers
) {