Skip to content

Commit

Permalink
remove exessive useEffect.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonasbrunvoll committed May 8, 2024
1 parent 6d8c369 commit 15f80f2
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions src/page-modules/assistant/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,7 @@ import { PageText, useTranslation } from '@atb/translations';
import { FocusScope } from '@react-aria/focus';
import { AnimatePresence, motion } from 'framer-motion';
import { useRouter } from 'next/router';
import {
FormEventHandler,
PropsWithChildren,
useEffect,
useState,
} from 'react';
import { FormEventHandler, PropsWithChildren, useState } from 'react';
import style from './assistant.module.css';
import { FromToTripQuery } from './types';
import { createTripQuery, setTransportModeFilters } from './utils';
Expand Down Expand Up @@ -121,10 +116,9 @@ function AssistantLayout({ children, tripQuery }: AssistantLayoutProps) {

const { urls, orgId } = getOrgData();
const { isDarkMode } = useTheme();
useEffect(() => {
tripQuery.transportModeFilter === null &&
onTransportFilterChanged(setTransportModeFilters(transportModeFilter));
}, [transportModeFilter]); //eslint-disable-line react-hooks/exhaustive-deps

if (tripQuery.transportModeFilter === null)
onTransportFilterChanged(setTransportModeFilters(transportModeFilter));

return (
<div>
Expand Down

0 comments on commit 15f80f2

Please sign in to comment.