Skip to content

Commit

Permalink
🛠️ Profile Page Scroll 이슈 수정 (#84)
Browse files Browse the repository at this point in the history
* fix: profile scroll 이슈 해결

router/index.ts에 ScrollRestoration를 추가하였습니다.

* feat: ScrollRestoration RootLayout으로 이동

* feat: ussFeedKebabStore export 설정

* feat: FeedMainPage closeKebab 추가

useEffect의 클린업 기능을 사용해, FeedMainPage가 언마운트 될 시 kebab메뉴가 닫히도록 했습니다.

Closes #84
  • Loading branch information
Legitgoons authored May 29, 2024
1 parent e30bc1d commit 1975ccc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/app/layout/RootLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { IPhoneLayout } from 'react-iphone-layout';
import 'react-iphone-layout/dist/ReactIPhoneLayout.css';
import { Outlet } from 'react-router-dom';
import { Outlet, ScrollRestoration } from 'react-router-dom';

import './RootLayout.scss';

Expand All @@ -15,6 +15,11 @@ export const RootLayout = () => {
<div className='wrap'>
<Outlet />
</div>
<ScrollRestoration
getKey={(location) => {
return location.pathname;
}}
/>
</IPhoneLayout>
);
};
9 changes: 9 additions & 0 deletions src/pages/feed-main/ui/FeedMainPage.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { useEffect } from 'react';

import { useFeedKebabStore } from '@/widgets/feed-kebab';
import { FeedMainHeader } from '@/widgets/feed-main-header';
import { FeedMainList } from '@/widgets/feed-main-list';
import './FeedMainPage.scss';

export const FeedMainPage = () => {
useEffect(() => {
return () => {
useFeedKebabStore.getState().closeKebab();
};
}, []);

return (
<main className='feed-main-page'>
<FeedMainHeader />
Expand Down
1 change: 1 addition & 0 deletions src/widgets/feed-kebab/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { FeedKebabButton } from './ui';
export { useFeedKebabStore } from './store';

0 comments on commit 1975ccc

Please sign in to comment.