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

DefaultBinding BindingMode.OneTime is not working correctly #598

Closed
ne0guille opened this Issue Jun 28, 2017 · 2 comments

Comments

Projects
None yet
4 participants
@ne0guille

ne0guille commented Jun 28, 2017

I'm submitting a bug report

  • Operating System: Windows 7 |10
  • Node Version: 6.9.0 | 8.0.0
  • NPM Version: 3.10.10 | 4.0.0
  • JSPM OR Webpack AND Version webpack 2.3.1
  • Browser: all
  • Language: JS || TypeScript 2.3.2

Current behavior:

@bindable({ defaultBindingMode: bindingMode.oneTime }) text

if i set the bindingMode to onetime, and use text.bind in the HTML, it doesnt work as a onetime binding, but if i use text.one-time in the HTML it does work as expected

Here is the gist, if you change the text.bind to text.one-time in the HTML it work as expected.

https://gist.run/?id=5f7b001f9ffefe47d0f06c71a71474e9
Expected/desired behavior:

Setting the bindindable defaultBindingMode: bindingMode.oneTime on the VM and using the property.bind in the View should work.

@EisenbergEffect

This comment has been minimized.

Show comment
Hide comment
@EisenbergEffect

EisenbergEffect Jul 2, 2017

Member

@jdanyow Can you take a look into this?

Member

EisenbergEffect commented Jul 2, 2017

@jdanyow Can you take a look into this?

@bigopon

This comment has been minimized.

Show comment
Hide comment
@bigopon

bigopon Sep 2, 2017

Member

@EisenbergEffect @jdanyow

Related: #609

This bug is caused by line 69 in syntax interpreter

info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context),

The cause is info.defaultBindingMode = 0 when specified inside bindable, thus will be resolved to bindingMode.oneWay

There are 3 ways to fix this though:

info.defaultBindingMode !== null && info.defaultBindingMode !== void 0 ? info.defaultBindingMode : this.determineDefaultBindingMode(element, info.attrName, context),

// or
typeof info.defaultBindingMode === 'number' ? info.defaultBindingMode || determine(...)

// or increase number in bindingMode in binding by 1
bindingMode.oneTime = 1
bindingMode.oneWay = 2 ...
Member

bigopon commented Sep 2, 2017

@EisenbergEffect @jdanyow

Related: #609

This bug is caused by line 69 in syntax interpreter

info.defaultBindingMode || this.determineDefaultBindingMode(element, info.attrName, context),

The cause is info.defaultBindingMode = 0 when specified inside bindable, thus will be resolved to bindingMode.oneWay

There are 3 ways to fix this though:

info.defaultBindingMode !== null && info.defaultBindingMode !== void 0 ? info.defaultBindingMode : this.determineDefaultBindingMode(element, info.attrName, context),

// or
typeof info.defaultBindingMode === 'number' ? info.defaultBindingMode || determine(...)

// or increase number in bindingMode in binding by 1
bindingMode.oneTime = 1
bindingMode.oneWay = 2 ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment