feat(router): 修复HashRouter push与当前页面相同的URL时页面不刷新的问题

This commit is contained in:
huangxuan 2024-04-02 10:53:25 +08:00
parent 78f4bce57c
commit aa4984f997
No known key found for this signature in database
GPG Key ID: E79F50C67022565D
1 changed files with 3 additions and 1 deletions

View File

@ -66,7 +66,9 @@ export function getBaseHistory<S>(
Object.assign(historyProps, nextState); Object.assign(historyProps, nextState);
} }
historyProps.length = browserHistory.length; historyProps.length = browserHistory.length;
const args = { location: historyProps.location, action: historyProps.action }; // 避免location饮用相同时setState不触发
const location = Object.assign({}, historyProps.location);
const args = { location: location, action: historyProps.action };
transitionManager.notifyListeners(args); transitionManager.notifyListeners(args);
}; };
} }