aurelia / framework

The Aurelia 1 framework entry point, bringing together all the required sub-modules of Aurelia.
MIT License
11.76k stars 623 forks source link

Weird behaviour (reference not cleaned up) with slots and validation #820

Open thinkOfaNumber opened 7 years ago

thinkOfaNumber commented 7 years ago

I'm submitting a bug report

Please tell us about your environment:

Current behavior: I'll link to a fork of the skeleton project, but basically the behaviour is this:

  1. add an item to the array
  2. remove the item from the array
  3. validate the parent controller

and the layout of the elements is:

  1. the welcome page has a custom element "abc"
  2. "abc" just has a single <slot></slot> in it
  3. inside the <abc></abc> there is a repeating simple custom element that I called "thing"
  4. inside thing is some basic validated properties

The result of this is that the properties in "thing" are validated, even though there are no elements in the thing array. And hence the validation fails. If I replace <abc></abc> with a <div></div> this behaviour does not occur.

Expected/desired behavior:

I would expect that the same thing happens with a slot as without it. It seems as though something in the slot is holding on to a reference of it contents and not letting it get disposed properly.

Here's the reproduction: https://github.com/thinkOfaNumber/skeleton-navigation I can trim it down a bit more or turn it into a gist if required.

(I'm going away for 1/2 day so won't be able to reply immediately) thanks for looking into it!

thinkOfaNumber commented 7 years ago

OK here's a working gist showing the odd behaviour: https://gist.run/?id=74d33945221dd5fa6aa01b42d310f097

I can't find a workaround to this, and there's a lot of places we're using slots with validation...

EisenbergEffect commented 7 years ago

@jdanyow Can you take a look at this?

Alexander-Taran commented 6 years ago

pinging @jdanyow

thinkOfaNumber commented 6 years ago

gist.run seems to be overwriting my gists when I fork new ones from gist.run, so that gist looks empty... if you look at the revisions here you can still see how to reproduce it. Let me know if you want me to get the gist going again.