Why Gemfury? Push, build, and install  RubyGems npm packages Python packages Maven artifacts PHP packages Go Modules Debian packages RPM packages NuGet packages

Repository URL to install this package:

Details    
@skava/router / src / deps / isUniqRouteChange.ts
Size: Mime:
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