Repository URL to install this package:
|
Version:
5.0.2 ▾
|
import { isObj } from 'exotic'
import { DefaultPropsWithRouter } from '../typings'
/**
* @todo - should be callable in oneRouter specific
* needs to have immutable history list which is available
* but probably needs fork of react-router
*/
function isUniqueRouteChange<Props = DefaultPropsWithRouter<any>>(
prevProps: DefaultPropsWithRouter<Props>,
nextProps: DefaultPropsWithRouter<Props>
): boolean {
// @NOTE can use this to force every route change fetch
// return true
return (
isObj(prevProps) &&
isObj(prevProps.location) &&
prevProps.location.pathname !== nextProps.location.pathname
// (prevProps.location.key !== nextProps.location.key ||
// || prevProps.location.search !== nextProps.location.search
)
}
export { isUniqueRouteChange, isUniqueRouteChange as isUniqRouteChange }
export default isUniqueRouteChange