fix: 캡챠 화면 미실행 수정#39
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
To continue reviewing without waiting, purchase usage credits in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (2)
Walkthrough이 PR은 API 라우팅을 쿼리 매개변수에서 경로 매개변수 스타일로 변경하고, 캡차 에러 감지 로직을 단순화하며, QR 스캔 제출 흐름에 동시성 가드를 추가합니다. ChangesQR 스캔 API 라우팅 및 동시성 개선
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/pages/QRScan/hooks/useQRScanPage.ts (1)
524-550:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win갤러리 경로에서 동기 예외 시 제출 락이 해제되지 않을 수 있습니다.
beginScanSubmission()이후 Promise 체인 이전 구간에서 예외가 나면.finally()에 도달하지 않아isScanSubmittingRef/isCapturing이 고정될 수 있습니다. 전체 구간을try/finally로 감싸 해제를 보장해 주세요.🔧 제안 수정안
- const handleGalleryFileChange = useCallback( - (event: ChangeEvent<HTMLInputElement>) => { + const handleGalleryFileChange = useCallback( + async (event: ChangeEvent<HTMLInputElement>) => { const selectedFile = event.target.files?.[0]; if (!selectedFile) { return; } if (!beginScanSubmission()) { event.target.value = ''; return; } - const photoUrl = URL.createObjectURL(selectedFile); - - updateCaptureRecord({ - badgeLabel: 'UPLOAD', - capturedAt: formatCapturedAt(new Date()), - headline: selectedFile.name, - photoUrl, - summary: '갤러리 이미지를 불러와 최근 기록에 반영했습니다.', - }); - - void submitScanFile({ - file: selectedFile, - fileName: selectedFile.name, - onSuccessMessage: '이미지를 업로드하고 분석을 시작했습니다.', - }) - .catch((error) => { - console.error('Failed to upload QR scan image from gallery.', error); - showApiError(message, error, '갤러리 이미지 업로드에 실패했습니다.'); - }) - .finally(() => { - finishScanSubmission(); - }); - - event.target.value = ''; + try { + const photoUrl = URL.createObjectURL(selectedFile); + + updateCaptureRecord({ + badgeLabel: 'UPLOAD', + capturedAt: formatCapturedAt(new Date()), + headline: selectedFile.name, + photoUrl, + summary: '갤러리 이미지를 불러와 최근 기록에 반영했습니다.', + }); + + await submitScanFile({ + file: selectedFile, + fileName: selectedFile.name, + onSuccessMessage: '이미지를 업로드하고 분석을 시작했습니다.', + }); + } catch (error) { + console.error('Failed to upload QR scan image from gallery.', error); + showApiError(message, error, '갤러리 이미지 업로드에 실패했습니다.'); + } finally { + finishScanSubmission(); + event.target.value = ''; + } }, [beginScanSubmission, finishScanSubmission, message, submitScanFile, updateCaptureRecord], );🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/pages/QRScan/hooks/useQRScanPage.ts` around lines 524 - 550, The code calls beginScanSubmission() then performs synchronous work (creating a blob URL, updateCaptureRecord, and starting submitScanFile()) but if a synchronous exception occurs before the Promise chain the submission lock (isScanSubmittingRef / isCapturing) won't be released; wrap the whole post-beginScanSubmission block in try { ... } finally { finishScanSubmission(); } so finishScanSubmission() always runs, move the submitScanFile() call inside the try and keep its existing .catch/.finally semantics for upload-specific cleanup, and ensure event.target.value = '' and URL.createObjectURL(selectedFile) / updateCaptureRecord(...) are inside the try so any thrown errors still trigger the finally; reference beginScanSubmission, submitScanFile, updateCaptureRecord, finishScanSubmission, isScanSubmittingRef/isCapturing, and selectedFile when making the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/pages/QRScan/hooks/useQRScanPage.ts`:
- Around line 524-550: The code calls beginScanSubmission() then performs
synchronous work (creating a blob URL, updateCaptureRecord, and starting
submitScanFile()) but if a synchronous exception occurs before the Promise chain
the submission lock (isScanSubmittingRef / isCapturing) won't be released; wrap
the whole post-beginScanSubmission block in try { ... } finally {
finishScanSubmission(); } so finishScanSubmission() always runs, move the
submitScanFile() call inside the try and keep its existing .catch/.finally
semantics for upload-specific cleanup, and ensure event.target.value = '' and
URL.createObjectURL(selectedFile) / updateCaptureRecord(...) are inside the try
so any thrown errors still trigger the finally; reference beginScanSubmission,
submitScanFile, updateCaptureRecord, finishScanSubmission,
isScanSubmittingRef/isCapturing, and selectedFile when making the change.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: f796e775-d03c-4a30-991c-84fcfa7ea217
📒 Files selected for processing (7)
api/be1.jsapi/be3.jssrc/features/scan-url/api/uploadErrors.test.tssrc/features/scan-url/api/uploadErrors.tssrc/pages/QRScan/QRScanPage.tsxsrc/pages/QRScan/hooks/useQRScanPage.tsvercel.json
💤 Files with no reviewable changes (2)
- api/be3.js
- api/be1.js
Summary
캡챠 화면 미실행으로 인한 코드 수정
해당 PR에 대한 작업 요약을 작성해주세요.
Tasks
캡챠 화면 실행
Summary by CodeRabbit
버그 수정
Chores