Skip to content

Commit

Permalink
Update linting
Browse files Browse the repository at this point in the history
  • Loading branch information
samwisekind committed Oct 28, 2024
1 parent 290059e commit 38575d5
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
3 changes: 3 additions & 0 deletions next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ const nextConfig: NextConfig = {
experimental: {
scrollRestoration: true
},
sassOptions: {
silenceDeprecations: ['legacy-js-api'],
},
images: {
remotePatterns: [{
protocol: 'https',
Expand Down
2 changes: 1 addition & 1 deletion src/components/Toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const Toolbar = ({

const timeout = setTimeout(getData, 500);
return () => clearTimeout(timeout);
}, [search]);
}, [search, catalogue]);

const handleSearchChange = (value: string) => setSearch(value);

Expand Down
1 change: 1 addition & 0 deletions src/helpers/rendering/embedded-entries.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const renderModule = (data: Node['data']) => {
<input type="hidden" name="cmd" value="_s-xclick" />
<input type="hidden" name="hosted_button_id" value="68DD5VDPDK3TQ" />
<input type="image" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_GB/i/btn/btn_subscribe_SM.gif" name="submit" alt="PayPal - The safer, easier way to pay online." />
{/* eslint-disable-next-line @next/next/no-img-element */}
<img alt="" src="https://www.paypalobjects.com/WEBSCR-640-20110401-1/en_GB/i/scr/pixel.gif" width="1" height="1" />
</form>
);
Expand Down
37 changes: 24 additions & 13 deletions src/pages/research/catalogues/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,29 @@ import { Card, Filters, Loading } from '@/components';

import styles from './index.module.scss';

interface updateURLProps {
catalogue: Catalogues,
page: number,
search: string,
}

const updateURL = ({
catalogue,
page,
search,
}: updateURLProps) => {
let newURL: URL | string = new URL(location.toString());

newURL.searchParams.set('catalogue', catalogue);
newURL.searchParams.set('page', String(page));
if (search !== '') {
newURL.searchParams.set('search', search);
}

newURL = newURL.toString();
history.replaceState({ ...window.history.state, as: newURL, url: newURL }, '', newURL);
};

interface PageProps {
pageData: PageData,
}
Expand Down Expand Up @@ -66,6 +89,7 @@ const Page: NextPage<PageProps> = ({
const result: CatalogueAPIResponse = await response.json();
setSearchText(search);
setData(result);
updateURL({ catalogue, page, search });

setLoading(false);
};
Expand All @@ -74,19 +98,6 @@ const Page: NextPage<PageProps> = ({
return () => clearTimeout(timeout);
}, [catalogue, page, search]);

useEffect(() => {
let newURL: URL | string = new URL(location.toString());

newURL.searchParams.set('catalogue', catalogue);
newURL.searchParams.set('page', String(page));
if (search !== '') {
newURL.searchParams.set('search', search);
}

newURL = newURL.toString();
history.replaceState({ ...window.history.state, as: newURL, url: newURL }, '', newURL);
}, [data]);

const handleCatalogueChange = (value: Catalogues) => {
setPage(1);
setCatalogue(value);
Expand Down

0 comments on commit 38575d5

Please sign in to comment.