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

Unique comp props #1243

Merged
merged 3 commits into from
Mar 5, 2015
Merged

Unique comp props #1243

merged 3 commits into from
Mar 5, 2015

Conversation

ssorallen
Copy link
Contributor

If multiple computed properties call the same method but with different
arguments, calls to the method are debounced because they pass the same
value as the task name. Rather than name the task only the method name,
use the full expression to let the developer ensure uniqueness.

Example:

computed: {
  foo: 'computeClassName(bar)',
  baz: 'computeClassName(xyz)'
}

Currently they both create property effects wrapped in debounce calls
with task names of '_computeClassName':

this.debounce('_computeClassName', function() { ... })
this.debounce('_computeClassName', function() { ... })

By passing the full expression rather than the method name, they result
in unique debounce task names:

this.debounce('_computeClassName(bar)', function() { ... })
this.debounce('_computeClassName(xyz)', function() { ... })

Ross Allen added 2 commits March 2, 2015 15:34
If multiple computed properties call the same method but with different
arguments, calls to the method are debounced because they pass the same
value as the task name. Rather than name the task only the method name,
use the full expression to let the developer ensure uniqueness.

Example:

```js
computed: {
  foo: 'computeClassName(bar)',
  baz: 'computeClassName(xyz)'
}
```

Currently they both create property effects wrapped in debounce calls
with task names of '_computeClassName':

```js
this.debounce('_computeClassName', function() { ... })
this.debounce('_computeClassName', function() { ... })
```

By passing the full expression rather than the method name, they result
in unique debounce task names:

```js
this.debounce('_computeClassName(bar)', function() { ... })
this.debounce('_computeClassName(xyz)', function() { ... })
```

Fixes #1242
The test fails without the other change in this branch.
@peterwmwong
Copy link
Contributor

+1

@sorvell
Copy link
Contributor

sorvell commented Mar 5, 2015

LGTM Thx! (will merge after conflicts are resolved)

Conflicts:
	test/unit/bind-elements.html
kevinpschaaf added a commit that referenced this pull request Mar 5, 2015
@kevinpschaaf kevinpschaaf merged commit c6ceda0 into 0.8-preview Mar 5, 2015
@kevinpschaaf kevinpschaaf deleted the unique-comp-props branch March 5, 2015 05:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants