owl icon indicating copy to clipboard operation
owl copied to clipboard

<t t-set="o" t-value="o"/> with a getter for o

Open Polymorphe57 opened this issue 2 years ago • 4 comments

A crash occurs in the simple situation described

in playground

Polymorphe57 avatar Jul 17 '23 13:07 Polymorphe57

I'm not sure what's unexpected about this, trying to set a property that only has a getter seems like it should crash?

sdegueldre avatar Jul 17 '23 15:07 sdegueldre

well, we probably expect that t-set stays inside the template. It's kind of the same as this:

const a = 1;
{
  let a = 2;
  a += 5; // or whatever, do something with a;
}

ged-odoo avatar Jul 18 '23 07:07 ged-odoo

Note that the example given by Mathieu is actually weird. Here is a different example, where we don't reuse the variable in the value: example

ged-odoo avatar Jul 18 '23 07:07 ged-odoo

Oh I see the issue now. The problem is that while we encounter a boundary and try to set the property on the sub-object, because the property exists in the prototype chain, the getter/setter is invoked and we get a crash because there the property is getter-only on the prototype.

sdegueldre avatar Jul 18 '23 11:07 sdegueldre