diff --git a/src/lib/adapters/nextjs/index.tsx b/src/lib/adapters/nextjs/index.tsx index 19bd0e0..fdc43fa 100644 --- a/src/lib/adapters/nextjs/index.tsx +++ b/src/lib/adapters/nextjs/index.tsx @@ -39,7 +39,7 @@ interface Props { // tslint:disable-next-line:no-mixed-interface readonly routerAsPath?: () => string readonly routerQuery?: () => ParsedUrlQuery - readonly clientSideQuery: () => string + readonly clientSideHref: () => string readonly clientSideSearch: () => string readonly routerPush?: ( url: Url, @@ -57,7 +57,7 @@ interface Props { // FIXME: Somehow imports are messed up for nextjs when importing from modules (see https://github.com/vercel/next.js/issues/36794) const Router = (NextRouter as any as { readonly default: Router$ }).default -const defaultClientSideQuery = () => window.location.href +const defaultClientSideHref = () => window.location.href const defaultClientSideSearch = () => window.location.search const queryFromPath = (path: string) => { @@ -75,7 +75,7 @@ export const GeschichteForNextjs: FC = ({ routerQuery, routerPush, routerReplace, - clientSideQuery, + clientSideHref, clientSideSearch, }) => { const lastClientSideQuery = useRef(initialClientOnlyAsPath) @@ -155,7 +155,7 @@ export const GeschichteForNextjs: FC = ({ useEffect(() => { // tslint:disable-next-line - lastClientSideQuery.current = clientSideQuery() + lastClientSideQuery.current = clientSideHref() updateFromQuery(clientSideSearch()) // tslint:disable-next-line:no-let let skipEvent = true @@ -173,7 +173,7 @@ export const GeschichteForNextjs: FC = ({ return () => { Router.events.off('beforeHistoryChange', routeChangeStartHandler) } - }, [updateFromQuery, clientSideQuery, clientSideSearch]) + }, [updateFromQuery, clientSideHref, clientSideSearch]) useEffect(() => { const { unregister } = state @@ -197,7 +197,7 @@ type ClientOnlyProps = Pick< > & { readonly children: ReactNode readonly omitQueries?: boolean -} & Partial> +} & Partial> // see https://nextjs.org/docs/api-reference/next/router#routerpush for options; // in general we want shallow (see https://nextjs.org/docs/routing/shallow-routing) routing in most cases and not scroll @@ -208,7 +208,7 @@ export const GeschichteForNextjsWrapper: FC = ({ defaultPushOptions = defaultRoutingOptions, defaultReplaceOptions = defaultRoutingOptions, clientSideSearch = defaultClientSideSearch, - clientSideQuery = defaultClientSideQuery, + clientSideHref = defaultClientSideHref, ...props }) => { const { asPath } = useRouter() @@ -235,7 +235,7 @@ export const GeschichteForNextjsWrapper: FC = ({ initialClientOnlyAsPath={thisAsPath} defaultReplaceOptions={defaultReplaceOptions} defaultPushOptions={defaultPushOptions} - clientSideQuery={clientSideQuery} + clientSideHref={clientSideHref} clientSideSearch={clientSideSearch} asPath={pp} {...props}