-
-
Notifications
You must be signed in to change notification settings - Fork 55
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
oneTime binding inside if inside repeat does not work as expected #356
Comments
Contrary to the original issue (aurelia/framework#301) the bug does not depend on the number of bindings in the element and does not go away when using |
After having a quick look at how repeat works, it is clear why this fails.
The only reliable solution I see is disabling Edit: I’ve just discovered that there’s already a mechanism for this, but It seems to me that the behaviors or viewFactories need to contain some information about whether they contain one-time bindings to trigger the full view lifecycle in that case. |
After trying for a few hours, it seems to me like there’s no way to
I see two options:
@EisenbergEffect Any better ideas? |
Fixes aurelia#356 within sub-views
@rluba Is the reason that it's difficult to find because some oneTime bindings are the result of a binding behavior rather than an attribute binding command? @jdanyow Worked most on the this area of code, so he might have some ideas on what we can do. If it's a result of what I mention above, maybe there's some way we can reliably and consistently tag things. |
@EisenbergEffect Yes, that’s the reason. Currently, the binding behaviors can only be distinguished and enumerated after they have been instantiated. I’d be interested to hear @jdanyow’s suggestions because my solution seems to work, but is far from idea. |
@jdanyow Can you take a look at the PR linked above and let us know what you think? |
The fix proposed looks good enough for me for |
Only because I haven’t used them yet. @bigopon Can you give me an example for both? Then I’ll update my solution to fix them, if necessary. |
@rluba <template>
<!-- instead of -->
<my-big-form>
<input value.bind="data.address.number">
<input value.bind="data.address.street">
</my-big-form>
<!-- do -->
<my-big-form with.bind="data.address">
<input value.bind="number">
<input value.bind="street">
</my-big-form>
</template> |
I finally gave it a try: I can’t find any unexpected behavior when using |
Thanks for testing that out @rluba and thanks for your patience in this! @bigopon Can you make a final review of the fix that @rluba is proposing and make a recommendation? If you don't see any other issues then we can get this merged and probably released in the next few days. Let me know what you think. |
Fixes aurelia#356 within sub-views
I'm submitting a bug report
1.7.1
Please tell us about your environment:
Operating System:
OSX 10.x
Node Version:
8.9.1
NPM Version:
61.0
JSPM OR Webpack AND Version
webpack@4.8.3
Browser:
all
Language:
all
Current behavior:
Similar to aurelia/framework#301:
repeat.for
andoneTime
bindings don’t work properly together.The specific problem in aurelia/framework#301 is fixed, but as soon as you insert a
if.bind
between therepeat.for
and the One-Time-Binding, the problem reappears:welcome.html
welcome.js
After clicking the button, the content reads
i.e. the number of items is updated, but their content is not.
Expected/desired behavior:
After clicking the button, the content should be
The text was updated successfully, but these errors were encountered: