Prevent reloading for same page URL hash change, Fixes #100

This commit is contained in:
Manoj Vivek 2020-05-30 11:24:16 +05:30
parent d5bc371913
commit c49730c1e0

View file

@ -116,10 +116,28 @@ export function onAddressChange(newURL, force) {
return;
}
const isHashDiff = isHashOnlyChange(newURL, address);
if (isHashDiff) {
return;
}
dispatch(newAddress(newURL));
};
}
function isHashOnlyChange(newURL, oldURL) {
if (!newURL || !oldURL) {
return false;
}
let diff = newURL.replace(oldURL, '').trim();
if (diff.startsWith('/')) {
diff = diff.substring(1);
}
return diff.startsWith('#');
}
export function onZoomChange(newLevel) {
return (dispatch: Dispatch, getState: RootStateType) => {
const {