From 6122ad2121a5ba17e63c029238b13ff332d7fc6a Mon Sep 17 00:00:00 2001 From: mihaisc Date: Thu, 28 Jan 2021 13:05:50 +0200 Subject: [PATCH] fix search navigation on localhost (#346) * fix search navigation on localhost * fix navigate in asset query --- src/components/molecules/SearchBar.tsx | 3 +-- src/components/organisms/AssetQueryList.tsx | 4 ++-- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/components/molecules/SearchBar.tsx b/src/components/molecules/SearchBar.tsx index c9cb13b1e..5486d8c74 100644 --- a/src/components/molecules/SearchBar.tsx +++ b/src/components/molecules/SearchBar.tsx @@ -1,5 +1,5 @@ import React, { useState, ChangeEvent, FormEvent, ReactElement } from 'react' -import { useNavigate } from '@reach/router' +import { navigate } from 'gatsby' import styles from './SearchBar.module.css' import Button from '../atoms/Button' import Input from '../atoms/Input' @@ -17,7 +17,6 @@ export default function SearchBar({ filters?: boolean size?: 'small' | 'large' }): ReactElement { - const navigate = useNavigate() const [value, setValue] = useState(initialValue || '') function handleChange(e: ChangeEvent) { diff --git a/src/components/organisms/AssetQueryList.tsx b/src/components/organisms/AssetQueryList.tsx index b25ae9cad..15c212df8 100644 --- a/src/components/organisms/AssetQueryList.tsx +++ b/src/components/organisms/AssetQueryList.tsx @@ -1,7 +1,8 @@ import AssetTeaser from '../molecules/AssetTeaser' import React from 'react' import { QueryResult } from '@oceanprotocol/lib/dist/node/metadatacache/MetadataCache' -import { useLocation, useNavigate } from '@reach/router' +import { useLocation } from '@reach/router' +import { navigate } from 'gatsby' import Pagination from '../molecules/Pagination' import { updateQueryStringParameter } from '../../utils' import styles from './AssetQueryList.module.css' @@ -20,7 +21,6 @@ const AssetQueryList: React.FC = ({ className }) => { const location = useLocation() - const navigate = useNavigate() // Construct the urls on the pagination links. This is only for UX, // since the links are no they will not work by itself.