Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UHF-9006: Fix Events search initial scroll to results #776

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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