Skip to content
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
14 changes: 11 additions & 3 deletions src/features/mypage/ui/section/ProjectListSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,17 @@ export const ProjectListSection = () => {
<ProjectListItem
key={project.projectId}
name={project.title}
onClick={() =>
navigate(DYNAMIC_ROUTE_PATHS.PROJECT_DETAIL(project.projectId))
}
onClick={() => {
if (project.status === "IN_PROGRESS") {
navigate(
`${ROUTE_PATHS.UPLOAD_STEP_BASE}/${project.projectId}/1`,
);
} else {
navigate(
DYNAMIC_ROUTE_PATHS.PROJECT_DETAIL(project.projectId),
);
}
}}
updatedAt={project.createdAt}
status={project.status}
roadmapType={project.roadmapType}
Expand Down
29 changes: 27 additions & 2 deletions src/pages/upload/_step/UploadStepPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ function UploadStepContent({

const [stepData, setStepData] = useState<ProjectStepResponse | null>(null);
const [isStepLoading, setIsStepLoading] = useState(false);
const [isStepResolved, setIsStepResolved] = useState(false);
const [isSaving, setIsSaving] = useState(false);
const [isCompleting, setIsCompleting] = useState(false);

Expand All @@ -175,7 +176,31 @@ function UploadStepContent({
const isLastStep = stepNum >= steps.length;

useEffect(() => {
if (!projectId || !stepCode) return;
if (!project) return;

const stepResponses = project.stepResponses ?? [];

if (stepNum === 1 && stepResponses.length > 0) {
const nextStepIndex = stepResponses.findIndex(
(step) => !step.userSubmittedResult,
);

const targetStep =
nextStepIndex === -1 ? stepResponses.length : nextStepIndex + 1;

if (targetStep !== stepNum) {
navigate(`${ROUTE_PATHS.UPLOAD_STEP_BASE}/${projectId}/${targetStep}`, {
replace: true,
});
return;
}
}

setIsStepResolved(true);
}, [project, stepNum, projectId, navigate]);
Comment on lines 178 to +200
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

PR 설명에 언급된 '이전 단계로' 버튼 비활성화 문제를 발견했습니다. 이는 사용자의 의도와 다른 페이지 이동을 유발하여 주요 기능 사용에 제약을 주는 문제입니다.

현재 구현은 stepNum과 관계없이 항상 targetStep으로 리디렉션하여, 사용자가 이전 단계로 이동할 수 없게 만듭니다.

이 로직은 사용자가 마이페이지에서 프로젝트를 처음 시작할 때만 실행되어야 합니다. 진입점이 /step/.../1 이므로, stepNum이 1일 때만 리디렉션 로직을 실행하도록 제한하면 이 문제를 해결할 수 있습니다. 아래와 같이 수정을 제안합니다.

  useEffect(() => {
    if (!project) return;

    const stepResponses = project.stepResponses ?? [];

    // 사용자가 이전 단계로 이동하는 것을 허용하기 위해,
    // 마이페이지에서 진입하는 첫 단계(stepNum === 1)에서만 다음 진행할 단계로 리디렉션합니다.
    if (stepNum === 1 && stepResponses.length > 0) {
      const nextStepIndex = stepResponses.findIndex(
        (step) => !step.userSubmittedResult,
      );

      const targetStep =
        nextStepIndex === -1 ? stepResponses.length : nextStepIndex + 1;

      if (targetStep !== stepNum) {
        navigate(`${ROUTE_PATHS.UPLOAD_STEP_BASE}/${projectId}/${targetStep}`, {
          replace: true,
        });
        return;
      }
    }

    setIsStepResolved(true);
  }, [project, stepNum, projectId, navigate]);

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

다음 이슈에서 처리하려했는데 stepNum === 1일 때만 리다이렉션되도록 수정하는 게 좋을 것 같습니다.
반영하겠습니다.


useEffect(() => {
if (!isStepResolved || !projectId || !stepCode) return;

const fetchStep = async () => {
setIsStepLoading(true);
Expand All @@ -193,7 +218,7 @@ function UploadStepContent({
};

fetchStep();
}, [projectId, stepCode]);
}, [isStepResolved, projectId, stepCode]);

const copyToClipboard = (text: string, setter: (v: boolean) => void) => {
if (!navigator?.clipboard?.writeText) {
Expand Down
Loading