Skip to content

Commit

Permalink
[Feature] - 여행 계획 & 여행기 상세 페이지로 이동 시 scroll 최상단으로 이동 되도록 변경 (#511)
Browse files Browse the repository at this point in the history
* refactor(TravelogueDetailPage): 여행기 상세 페이지 이동 시 최상단으로 스크롤 되도록 변경

* refactor(TravelPlanDetailPage): 여행 계획 상세 페이지 이동 시 최상단으로 스크롤 되도록 변경
  • Loading branch information
jinyoung234 authored Oct 14, 2024
1 parent 0c37e9f commit a2351d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import ReactGA from "react-ga4";
import { useNavigate, useParams } from "react-router-dom";

Expand Down Expand Up @@ -86,6 +86,10 @@ const TravelPlanDetailPage = () => {

useClickAway(iconButtonContainerRef, handleCloseMoreDropdown);

useEffect(() => {
window.scrollTo(0, 0);
}, []);

if (status === "pending" || status === "error") {
if (status === "error") {
alert(error.message);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import ReactGA from "react-ga4";
import { useNavigate, useParams } from "react-router-dom";

Expand Down Expand Up @@ -108,6 +108,10 @@ const TravelogueDetailPage = () => {
return handleActiveHeart(id);
};

useEffect(() => {
window.scrollTo(0, 0);
}, []);

if (
isGettingTraveloguePaused ||
isDeletingTraveloguePaused ||
Expand Down

0 comments on commit a2351d2

Please sign in to comment.