Skip to content
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

fix(name-binding): add extra props to update one time mode #741

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bigopon
Copy link
Member

@bigopon bigopon commented Mar 2, 2019

Thanks to @edwrd01 on Discourse at https://discourse.aurelia.io/t/issue-using-ref-in-a-repeat-for-with-a-value-converter/2328/5 , we uncover an issue related the combination of ref binding, repeat and value-converter/binding-behavior. The issue is due to repeat custom attribute unable to update ref binding, in case of a mutation in source collection, piped through value converter / binding behavior. i.e:

  <div repeat.for="item of items | vc & bb">

As it uses this https://github.com/aurelia/templating-resources/blob/0896552d553af0d69399b9b227317a26bdc14005/src/repeat-utilities.js#L109-L115 under the hood to update the bindings that do not employ observation, NameBinder is one of those binding types. There are two ways to fix it:

  1. add method updateOneTimeBindings to reassign target
  2. add binding mode oneTime, and add method call to reassign target

I went with (2) since it seems to align better with other bindings, also the location of this class (binding module).

cc @EisenbergEffect @fkleuver

@EisenbergEffect
Copy link
Contributor

This works for me. Let's make sure @fkleuver has a look and also considers this for vNext so we don't get a regression there after this is addressed in vCurrent.

@fkleuver
Copy link
Member

fkleuver commented Mar 5, 2019

This makes good sense to me. This would translate to implementing handleChange in ref.ts.

Just a friendly reminder, you could use this repo for e2e / integration tests: https://github.com/aurelia/e2e-tests
If you want to integration test this with real repeater / aurelia app, just add some tests there and make another push here, then CircleCI will run those tests against the binding version of this PR (and the npm@latest of all the other repos)

@fkleuver
Copy link
Member

fkleuver commented Apr 9, 2019

@bigopon do we have a matching issue for this in vNext so I/we don't forget?

@bigopon
Copy link
Member Author

bigopon commented Aug 31, 2019

Oh, we don't. Will add

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants