fix(study): 새 회차 진입 시 dropdown 에 (신규) 옵션 표시 — mode 전환 대신 옵션 추가
이전 fix(4c26b91)는 query 회차명이 examRounds 에 없을 때 mode='new' 자동 전환했지만,
사용자 화면은 여전히 select 모드 노출 (캐시 또는 동선 이슈). 더 직관적인 방식으로 수정:
- onMount 의 mode='new' 자동 전환 제거.
- select dropdown markup 에 query 회차가 examRounds 에 없으면 "(신규)" 라벨 옵션 추가.
- 사용자는 select 모드 그대로 유지하면서 신규 회차도 보임. 폼 제출 시 그 값 그대로 박힘.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -203,15 +203,6 @@
|
||||
f_qnum = found.next_question_number;
|
||||
}
|
||||
}
|
||||
// FIX: 새 회차 시작 동선 — query 로 받은 회차명이 기존 examRounds 에 없으면
|
||||
// 신규 회차로 보고 mode='new' + new input 에 채움 (dropdown 에 옵션이 없어서 안 보이는 회귀 차단).
|
||||
if (f_exam_round) {
|
||||
const exists = examRounds.some((r) => r.exam_round === f_exam_round);
|
||||
if (!exists) {
|
||||
f_exam_round_mode = 'new';
|
||||
f_exam_round_new = f_exam_round;
|
||||
}
|
||||
}
|
||||
// 진입 시점은 사용자가 input 박스를 만진 적 없음 — false 로 reset.
|
||||
f_qnum_user_edited = false;
|
||||
// $effect 의 lastExamRound 를 현재 값으로 sync — 첫 실행이 또 reset 하지 않도록.
|
||||
@@ -481,6 +472,11 @@
|
||||
{r.exam_round} ({r.question_count}{topicExamRoundSize ? `/${topicExamRoundSize}` : ''})
|
||||
</option>
|
||||
{/each}
|
||||
<!-- FIX: 회차 카드 페이지에서 [새 회차 시작] 으로 진입 시 query 회차명이 기존 examRounds 에 없으면
|
||||
그 회차를 (신규) 라벨로 dropdown 에 임시 추가 — select 옵션에 매칭이 없어서 안 보이는 회귀 차단 -->
|
||||
{#if f_exam_round && !examRounds.some((r) => r.exam_round === f_exam_round)}
|
||||
<option value={f_exam_round}>{f_exam_round} (신규)</option>
|
||||
{/if}
|
||||
</select>
|
||||
<button type="button" onclick={() => (f_exam_round_mode = 'new')}
|
||||
class="text-[11px] text-accent hover:underline shrink-0">새 회차</button>
|
||||
|
||||
Reference in New Issue
Block a user