Skip to content

Commit 9fec82d

Browse files
fix(State): do not return duplicate Param objs for url params in State.parameters()
1 parent e5485ad commit 9fec82d

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

src/state/hooks/transitionManager.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,8 @@ export default class TransitionManager {
8989
if (error instanceof TransitionRejection) {
9090
if (error.type === RejectType.IGNORED) {
9191
// Update $stateParmas/$state.params/$location.url if transition ignored, but dynamic params have changed.
92-
if (!Param.equals($state.$current.parameters().filter(prop('dynamic')), $stateParams, transition.params())) {
92+
let dynamic = $state.$current.parameters().filter(prop('dynamic'));
93+
if (!Param.equals(dynamic, $stateParams, transition.params())) {
9394
this.updateStateParams();
9495
}
9596
return $state.current;

src/state/state.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -114,12 +114,10 @@ export class State {
114114
return this.parent && this.parent.root() || this;
115115
}
116116

117-
parameters(opts: any = {}): Param[] {
117+
parameters(opts?): Param[] {
118118
opts = defaults(opts, { inherit: true });
119-
120-
return (this.parent && opts.inherit && this.parent.parameters() || [])
121-
.concat(this.url && this.url.parameters({ inherit: false }) || [])
122-
.concat(values(this.params));
119+
var inherited = opts.inherit && this.parent && this.parent.parameters() || [];
120+
return inherited.concat(values(this.params));
123121
}
124122

125123
parameter(id: string, opts: any = {}): Param {

0 commit comments

Comments
 (0)