Skip to content

Commit

Permalink
127818 bugfix white screen exhaustive-deps
Browse files Browse the repository at this point in the history
  • Loading branch information
remyvdwereld committed Oct 8, 2024
1 parent 178ebda commit 645504a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ const CreateItineraryPage: React.FC = () => {
if (redirectToExistingItinerary) {
redirectToCorrectItineraryPage(data?.itineraries)
}
}, [redirectToExistingItinerary, data, redirectToCorrectItineraryPage])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [redirectToExistingItinerary, data])

if (!teamSettings) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Spacing from "app/features/shared/components/atoms/Spacing/Spacing"
import DefaultLayout from "app/features/shared/components/layouts/DefaultLayout/DefaultLayout"
import to from "app/features/shared/routing/to"
import { useRedirectToCorrectItineraryPage } from "app/features/itineraries/utils/useRedirectToCorrectItineraryPage"
import CenteredSpinner from "app/features/shared/components/atoms/CenteredSpinner/CenteredSpinner"

const Li = styled.li`
margin-bottom: ${ themeSpacing(4) };
Expand All @@ -19,15 +20,17 @@ const TeamName = styled.strong`
`

const ListItinerariesPage: React.FC = () => {
const { data } = useItineraries()
const { data, isBusy } = useItineraries()
const { redirectToCorrectItineraryPage } = useRedirectToCorrectItineraryPage()

useEffect(() => {
redirectToCorrectItineraryPage(data?.itineraries)
}, [data, redirectToCorrectItineraryPage])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data])

return (
<DefaultLayout>
{isBusy && <CenteredSpinner explanation="Looplijsten ophalen…" size={60} />}
{ data && data.itineraries.length > 0 && (
<>
<Spacing pb={ 6 }>
Expand Down
3 changes: 2 additions & 1 deletion src/app/features/shared/components/pages/HomePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ const HomePage: React.FC = () => {

useEffect(() => {
redirectToCorrectItineraryPage(data?.itineraries)
}, [data, redirectToCorrectItineraryPage])
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data])

const explanation = errors.length > 0 ? "Sorry, de pagina kan niet worden geladen. Probeer het later opnieuw." : "Even geduld alstublieft…"

Expand Down

0 comments on commit 645504a

Please sign in to comment.