Skip to content

Commit

Permalink
feat(step3): fix error when routing to home page
Browse files Browse the repository at this point in the history
  • Loading branch information
canewton committed Dec 28, 2024
1 parent 1fe7296 commit d8f49ca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Button, Select } from 'antd';
import type { TableRowSelection } from 'antd/es/table/interface';
import { useRouter } from 'next/navigation';
import React, { useEffect, useState } from 'react';
import { useDispatch } from 'react-redux';

import AppLayout from '@/components/custom/AppLayout/AppLayout';
import EditableTable from '@/components/custom/EditableTable/EditableTable';
Expand All @@ -14,6 +15,7 @@ import { StandardText } from '@/components/custom/StandardText/StandardText';
import { VBox } from '@/components/custom/VBox/VBox';
import { useScenarioGroups } from '@/hooks/useScenarioGroups';
import { useFetchFeedQuery, usePatchModelMutation } from '@/store';
import { clearModel } from '@/store/slices/modelSlice';
import type { PlotModel } from '@/types/feed/Feed';

import { COLUMNS } from '../utils/constants';
Expand All @@ -26,6 +28,7 @@ const Index = () => {
);
const [selected, setSelected] = useState<number[]>([]);
const router = useRouter();
const dispatch = useDispatch();

const {
flowScenarios: flowScenarioOptions,
Expand All @@ -39,6 +42,7 @@ const Index = () => {
}, [data]);

useEffect(() => {
dispatch(clearModel());
refetch();
}, []);

Expand Down
7 changes: 1 addition & 6 deletions src/components/custom/AppLayout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import { useDispatch, useSelector } from 'react-redux';

import { BACKGROUND_COLOR, PRIMARY_COLOR } from '@/components/theme';
import { selectCurrentUser, setCredentials } from '@/store/slices/authSlice';
import { clearModel } from '@/store/slices/modelSlice';

import ProfileButton from './ProfileButton';

Expand All @@ -26,11 +25,7 @@ const AppLayout = ({ children }: PropsWithChildren) => {
const router = useRouter();
const titleRender = useCallback(
(logo: ReactNode) => (
<Link
href="/"
style={{ marginLeft: 20 }}
onClick={() => dispatch(clearModel())}
>
<Link href="/" style={{ marginLeft: 20 }}>
{logo}
</Link>
),
Expand Down

0 comments on commit d8f49ca

Please sign in to comment.