Skip to content

Commit

Permalink
UHF-9006: UHF-9006: add check if the search url is set.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jussiles committed Sep 21, 2023
1 parent b9e7c69 commit 4b3b371
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dist/js/linkedevents.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FormEvent } from 'react';
import { useAtomValue, useSetAtom } from 'jotai';

import LocationFilter from '../components/LocationFilter';
import ApiKeys from '../enum/ApiKeys';
import SubmitButton from '../components/SubmitButton';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import useScrollToResults from '@/react/common/hooks/useScrollToResults';
import Pagination from '../components/Pagination';
import ResultCard from '../components/ResultCard';
import SeeAllButton from '../components/SeeAllButton';
import { settingsAtom } from '../store';
import { settingsAtom, urlAtom } from '../store';
import type Event from '../types/Event';

type ResultsContainerProps = {
Expand All @@ -20,7 +20,10 @@ type ResultsContainerProps = {
function ResultsContainer({ count, events, loading, error }: ResultsContainerProps) {
const settings = useAtomValue(settingsAtom);
const scrollTarget = createRef<HTMLDivElement>();
useScrollToResults(scrollTarget, true);
const url = useAtomValue(urlAtom);
// Checks when user makes the first search and api url is set.
const choices = Boolean(url);
useScrollToResults(scrollTarget, choices);

if (loading) {
return (
Expand Down

0 comments on commit 4b3b371

Please sign in to comment.