Call the changedHandler after the value has been set
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 100
- Forks
- 22
- PR merge metrics
- No merged PRs in 30d
Description
I'm submitting a feature request
- Library Version:
1.1.0
Please tell us about your environment:
-
Operating System:
all -
Node Version:
all
- NPM Version:
all
- JSPM OR Webpack AND Version
both
-
Browser:
all -
Language:
all
Current behavior:
Whenever we subscribe to a part of the state, the changed handler will be called before the actual state is changed.
@autoinject()
@connectTo({
selector: {
list: store => store.state.pipe(pluck('list'))
}
})
export class App {
store;
list : string[] = [];
normalBinding : string;
constructor(store : Store<any>) {
this.store = store;
this.store.registerAction('addList', addList);
}
listChanged(newValue, oldValue) {
// this.list does not have the newValue yet, in contrast with normal
// aurelia behavior where this.list would have the value when this handler is called
}
normalBindingChanged(newValue, oldValue){
// this.normalBinding is already set at this moment
}
}
}
-
What is the expected behavior?
The bound value should be set before the changed-handler is invoked -
What is the motivation / use case for changing the behavior?
It aligns better with the default Aurelia behavior and meets the expectations of users better
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the @connectTo selector example and trace how the selected list value reaches listChanged. Add a regression test showing that the bound value is updated before its changed handler runs, then verify the existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100