Repository navigation
[FIX] owl-compiler: give each keyed site a unique render key - #2083
Merged
ged-odoo merged 1 commit intoDec 2, 2026
Conversation
alexkuhn
marked this pull request as ready for review
November 30, 2026 17:23
maki-odoo
reviewed
Dec 1, 2026
Before this commit, mounting a component crashes when one of its templates calls a sub-template with a body, and both the body and the sub-template render a component. Steps to reproduce: - Mount a component with the template `<div><t t-call="sub"><Child v="'B'"/></t></div>`, where the template `sub` is `<b><Child v="'A'"/><t t-out="0"/></b>`. The mount throws "Cannot read properties of null (reading 'bdom')", where `<div><b><i>A</i><i>B</i></b></div>` is expected. This happens because the `t-out="0"` of the sub-template renders the body with the key of that site, under the same node, while the ids in the keys of components and `t-call`s restart for each compiled template. The body is compiled in the caller's template, so its first component and the first one of the sub-template get the same key, and the second site reuses the component of the first one, which is mounted twice. The same happens with a dynamic `t-call`, and with a `t-call-slot` of the same name in the body and in the sub-template. The same keys also repeat in loops: the `t-out="0"`, `t-call-slot` and `t-set` body sites take as key only the `t-key` of their innermost loop, without the key of the template or of the outer loops. Their components then get the same key in each iteration of an outer loop, or of a loop that calls their template, such as a slot called in a loop of a sub-template that is itself called in a loop. After this commit, these sites get a unique id followed by the keys of all loops through `generateComponentKey()`, as components and `t-call`s already do. This also keeps apart the cache keys of `.signal=` sites once they start with the render key, as odoo#2066 does.
alexkuhn
force-pushed
the
master-fix-owl-component-in-a-t-call-body-collides-with-t-aku
branch
from
December 1, 2026 14:46
e6053eb to
459fe82
Compare
ged-odoo
approved these changes
Dec 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Before this commit, mounting a component crashes when one of its templates calls a sub-template with a body, and both the body and the sub-template render a component.
Steps to reproduce:
<div><t t-call="sub"><Child v="'B'"/></t></div>, where the templatesubis<b><Child v="'A'"/><t t-out="0"/></b>. The mount throws "Cannot read properties of null (reading 'bdom')", where<div><b><i>A</i><i>B</i></b></div>is expected.This happens because the
t-out="0"of the sub-template renders the body with the key of that site, under the same node, while the ids in the keys of components andt-calls restart for each compiled template. The body is compiled in the caller's template, so its first component and the first one of the sub-template get the same key, and the second site reuses the component of the first one, which is mounted twice. The same happens with a dynamict-call, and with at-call-slotof the same name in the body and in the sub-template.The same keys also repeat in loops: the
t-out="0",t-call-slotandt-setbody sites take as key only thet-keyof their innermost loop, without the key of the template or of the outer loops. Their components then get the same key in each iteration of an outer loop, or of a loop that calls their template, such as a slot called in a loop of a sub-template that is itself called in a loop.After this commit, these sites get a unique id followed by the keys of all loops through
generateComponentKey(), as components andt-calls already do. This also keeps apart the cache keys of.signal=sites once they start with the render key, as #2066 does.