mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-11-08 23:58:13 +08:00
fix(router-outlet): navigating to same route with different params now activates component (#24760)
resolves #24653
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
import { AnimationBuilder, ComponentProps, FrameworkDelegate, NavComponentWithProps } from '../../interface';
|
||||
import { attachComponent } from '../../utils/framework-delegate';
|
||||
import { assert } from '../../utils/helpers';
|
||||
import { assert, shallowEqualStringMap } from '../../utils/helpers';
|
||||
|
||||
export const VIEW_STATE_NEW = 1;
|
||||
export const VIEW_STATE_ATTACHED = 2;
|
||||
@ -54,29 +54,8 @@ export const matches = (view: ViewController | undefined, id: string, params: Co
|
||||
if (view.component !== id) {
|
||||
return false;
|
||||
}
|
||||
const currentParams = view.params;
|
||||
if (currentParams === params) {
|
||||
return true;
|
||||
}
|
||||
if (!currentParams && !params) {
|
||||
return true;
|
||||
}
|
||||
if (!currentParams || !params) {
|
||||
return false;
|
||||
}
|
||||
const keysA = Object.keys(currentParams);
|
||||
const keysB = Object.keys(params);
|
||||
if (keysA.length !== keysB.length) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Test for A's keys different from B.
|
||||
for (const key of keysA) {
|
||||
if (currentParams[key] !== params[key]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return shallowEqualStringMap(view.params, params);
|
||||
};
|
||||
|
||||
export const convertToView = (page: any, params: ComponentProps | undefined): ViewController | null => {
|
||||
|
||||
Reference in New Issue
Block a user