Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Race condition when compose.view-model is bound to an object literal expression #240
I think I am experiencing some kind of race condition when using a nested compose element inside a repeat.for. I've extracted it to a really simple example which can be seen in this gist:
The compose content is output twice in certain cells - sometimes it renders correctly which makes me think there is some kind of race conditions is going on here..
I am running latest Aurelia skeleton and posted on the gitter channel to ensure I wasn't the only one experiencing this.
A workaround seems to be to create a view model - and not use the html only.
Thanks in advance for helping me out.
It seems the problem only occurs when the view-model is defined inline
I found out that
Any guidance on where one might look to find the bug? I seem to be a little stuck tracking it down :).
So there seems to be two problems causing the bug to happen.
referenced this issue
Jul 17, 2016
If you switch
The problem is every time the expression is evaluated a new view-model instance is created due to the object literal expression in the binding. Ultimately looks like a bug in the compose where it's not handling view-model prop changes when they happen quickly.
changed the title from
Possible race condition when using compose in nested repeats
Race condition when compose.view-model is bound to an object literal expression
Feb 20, 2017
Has any work been done toward resolving this? This feature is really the linchpin to my project. I've apparently been lucky I didn't come across this issue earlier.
I'm using object literal expressions in my binding, however the difference in my situation is that I'm using object literals to specify which files to bind to, like so:
The issue manifests, similarly as explained above, that when I move an item between two arrays that are being rendered via a repeat.for, the moved item is rendered twice. I have verified that the destination array contains only one instance of the item.
At the very least, is there a way to one-time bind to a file as a stopgap or would that potentially cause other issues?
In the meantime, I found a super hacky way to get around it by using a