-
-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple composed views rendered at once #43
Comments
Hi @klinki, thanks for the detailed description and the repro repo. I will have a look within the next week. |
I released your suggested fix as 2.4.2. I ended up with this solution as I had no better one. Of course, it's hacky, but I think it does the thing. Just out of interest: How long do you (and your company) plan on using this plugin (and associated Knockout/Durandal)? It was never intended as a permanent solution, but only as a help for migration to aureia. Since both frameworks have not seen any further development for years, maintenance is becoming increasingly difficult. |
Honestly, if I had enough development and test capacity we would be migrated to Aurelia already. Sometimes I have to fix some bug or add some functionality to it and I decided to move to aurelia with aurelia-knockout There has been lot of other work with higher priority and I'm barely finishing DurandalJS migration to aurelia with aurelia-knockout now (it is still living on separate git branch and it just moved from test to staging environment). Anyway, thanks for looking into it. As this issue happens only on small part of application I guess I will move that part into aurelia and get rid of this issue once for all. |
Great, thanks for your feedback. |
Hello,
I have found a bug in
data-bind="compose:
composition. If you change composed view quickly enough, it can get into situation when it renders multiple views instead of just a last one.This happens mostly when .html for the template is not yet loaded, so it seems to be some kind of race condition.
Here is simple repro repository: https://github.com/klinki/aurelia-knockout-composedview-bug
(I'd host it on https://codesandbox.io/ but that doesn't seem to be working anymore since it adds
<script>
tags into templates and stackblitz.io doesn't work for me at the moment either :( )I tried to play with it little bit but I couldn't solve it completely :( I tried to use following modification of
doComposition
method inknockout-composition.js
file:Unfortunately that still didn't solve the problem :(
I believe problem is in
KnockoutComposition.prototype.register
method inko.bindingHandlers.compose.update
function and probably in this part:if (element.childElementCount > 0)
. I suppose race condition happens so the value evaluates to 0. But meanwhile, child element gets loaded and whendoComposition.call
is called, it adds another child view without detaching and removing the old ones. But it is just an idea.The text was updated successfully, but these errors were encountered: