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

[feat/CK-245] 검색로직 개선 및 컴포넌트 lazy오류를 해결한다 #213

Closed
wants to merge 4 commits into from
Closed
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
4 changes: 2 additions & 2 deletions client/.husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
# . "$(dirname -- "$0")/_/husky.sh"

cd client && echo 👩🏿‍💻FE 👩🏿‍💻 pre-commit rules applying... && npm run lint-fix && node checkUtilTests.js && npm test
# cd client && echo 👩🏿‍💻FE 👩🏿‍💻 pre-commit rules applying... && npm run lint-fix && node checkUtilTests.js && npm test
23 changes: 8 additions & 15 deletions client/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { lazy, Suspense } from 'react';
import { Suspense, lazy } from 'react';
import { BrowserRouter, Route, Routes } from 'react-router-dom';
import theme from '@styles/theme';
import GlobalStyle from '@styles/GlobalStyle';
Expand All @@ -13,13 +13,11 @@ import RoadmapCreatePage from './pages/roadmapCreatePage/RoadmapCreatePage';
import ToastProvider from '@/components/_common/toast/Toast';
import MyPage from '@pages/myPage/MyPage';
import UserInfoProvider from './components/_providers/UserInfoProvider';
import RoadmapSearchResult from './components/roadmapListPage/roadmapSearch/RoadmapSearchResult';
import MainPage from '@pages/mainPage/MainPage';
import OAuthRedirect from './components/loginPage/OAuthRedirect';
import SessionHandler from '@components/_common/sessionHandler/SessionHandler';
import RouteChangeTracker from '@components/_common/routeChangeTracker/RouteChangeTracker';
import PrivateRouter from '@components/_common/privateRouter/PrivateRouter';
import { Spinner } from './components/_common/spinner/Spinner.styles';
import { CriticalErrorBoundary } from './components/_common/errorBoundary/CriticalErrorBoundary';

const GoalRoomDashboardPage = lazy(
Expand All @@ -46,17 +44,12 @@ const App = () => {
<Route path='/' element={<MainPage />} />
<Route path='/login' element={<LoginPage />} />
<Route path='/join' element={<SignUpPage />} />
<Route path='/roadmap-list' element={<RoadmapListPage />}>
<Route
path=':category/:search'
element={<RoadmapSearchResult />}
/>
</Route>
<Route path='/roadmap-list' element={<RoadmapListPage />} />
<Route path='/roadmap/:id' element={<RoadmapDetailPage />} />
<Route
path='/roadmap/:id/goalroom-list'
element={
<Suspense fallback={<Spinner />}>
<Suspense>
<GoalRoomListPage />
</Suspense>
}
Expand All @@ -72,17 +65,17 @@ const App = () => {
<Route
path='/roadmap/:id/goalroom-create'
element={
<PrivateRouter>
<Suspense fallback={<Spinner />}>
<Suspense>
<PrivateRouter>
<GoalRoomCreatePage />
</Suspense>
</PrivateRouter>
</PrivateRouter>
</Suspense>
}
/>
<Route
path='/goalroom-dashboard/:goalroomId'
element={
<Suspense fallback={<Spinner />}>
<Suspense>
<GoalRoomDashboardPage />
</Suspense>
}
Expand Down
75 changes: 0 additions & 75 deletions client/src/components/_common/error/ErrorComponents.tsx

This file was deleted.

70 changes: 0 additions & 70 deletions client/src/components/_common/error/errorComponents.styles.ts

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ErrorInfo } from 'react';
import { Runtime } from '../error/ErrorComponents';
import ErrorBoundary from './ErrorBoundary';
import { Runtime } from '../fallback/Fallback';

class RuntimeErrorBoundary extends ErrorBoundary {
static getDerivedStateFromError(error: Error): { didCatch: boolean; error: Error } {
Expand Down
8 changes: 8 additions & 0 deletions client/src/components/_common/fallback/Fallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ export const Runtime = () => {
};

export const Critical = () => {
const navigate = useNavigate();

const moveMainPage = () => {
navigate('/');
window.location.reload();
};

return (
<S.Container>
<S.ElephantImage src={elephantImage} alt='crying-elephant' />
Expand All @@ -65,6 +72,7 @@ export const Critical = () => {
다음에 다시 이용해주세요.
</S.CriticalText>
<S.MovePageButton>불편사항 문의하기</S.MovePageButton>
<S.MovePageButton onClick={moveMainPage}>메인페이지로 돌아가기</S.MovePageButton>
</S.Container>
);
};
Expand Down
3 changes: 1 addition & 2 deletions client/src/components/_common/roadmapItem/RoadmapItem.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { RoadmapDetailType } from '@myTypes/roadmap/internal';

import { useNavigate } from 'react-router-dom';
import SVGIcon from '@components/icons/SVGIcon';
import { DIFFICULTY_ICON_NAME } from '@constants/roadmap/difficulty';
Expand Down Expand Up @@ -77,7 +76,7 @@ const RoadmapItem = ({ item, hasBorder = true, roadmapId }: RoadmapItemProps) =>
<S.ItemFooter>
<S.Tags>
{item.tags.map((tag) => {
return <span># {tag.name}</span>;
return <span key={tag.id}># {tag.name}</span>;
})}
</S.Tags>
<S.CreatedBy>Created by {item.creator.name}</S.CreatedBy>
Expand Down
Loading
Loading