Conversation
刪除帳號時未清除本機 localStorage 進度,重新登入/註冊時被誤判為 訪客進度並搬遷回新帳號;同時在登出按鈕上方新增手動清除入口。 Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Review limit reached
Next review available in: 21 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
📝 WalkthroughWalkthroughAndroid release builds enable minification and resource shrinking. The web profile can clear local progress manually and after successful account deletion. A new functional-thinking guideline document defines principles for code organization, immutability, abstraction, higher-order functions, and concurrency. ChangesMobile build optimization
Web local progress clearing
Functional-thinking guidelines
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Profile
participant App
participant useProgress
participant localStorage
Profile->>App: invoke onClearLocalData
App->>useProgress: call resetLocalProgress
useProgress->>localStorage: remove persisted progress
useProgress->>useProgress: reset progress state
Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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.
Actionable comments posted: 3
🧹 Nitpick comments (2)
apps/web/src/screens/Profile.tsx (1)
20-26: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valueAdd user feedback after clearing local data.
Since clearing local data won't change the UI for a logged-in user (as their screen displays cloud data), consider adding a brief success alert to provide clear feedback that the action was completed. This matches the
alertusage in the error handling below.✨ Proposed refactor
const handleClearLocalData = () => { const confirmed = window.confirm( '確定要清除本機暫存的學習資料嗎?此操作無法復原,已同步到雲端的資料不受影響。', ) if (!confirmed) return onClearLocalData() + alert('已清除本機暫存資料') }🤖 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 `@apps/web/src/screens/Profile.tsx` around lines 20 - 26, Update handleClearLocalData so that, after onClearLocalData completes for a confirmed action, it shows a brief success alert to the user; keep the existing confirmation flow and do not alert when the action is cancelled.functional-thinking.md.md (1)
49-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winAvoid requiring
map/filter/reduceinstead of loops.This blanket rule can produce less-readable code for early exits, complex control flow, or effectful operations, and may encourage misusing
reducefor sequencing side effects. Reword it to prefer the clearest abstraction, while allowing loops when they better express the behavior.🤖 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 `@functional-thinking.md.md` at line 49, Revise the “告別手寫迴圈” guideline to prefer the clearest, most readable collection-processing abstraction rather than requiring map(), filter(), or reduce(). Explicitly allow loops for early exits, complex control flow, or effectful operations, and avoid implying that reduce() should sequence side effects.
🤖 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.
Inline comments:
In `@apps/web/src/hooks/useProgress.ts`:
- Around line 186-192: Update resetLocalProgress to always remove STORAGE_KEY,
but only call setProgress(defaultProgress) when the current user is a guest.
Preserve the existing signOut flow for account deletion so signed-in users’
active cloud progress is not cleared from in-memory state.
In `@functional-thinking.md.md`:
- Around line 33-35: Update the 防禦性複製 (Defensive copying) section to replace the
blanket deep-copy rule with explicit DTO/schema validation and normalization for
untrusted boundary data. State that only owned portions requiring isolation
should be copied, avoiding unconditional structuredClone() for potentially
non-cloneable values such as functions.
- Line 61: Update the “使用協調原語” guidance to define what Cut means before
presenting it as a coordination primitive, and revise the Queue description to
state its actual contract, including single-consumer or explicit synchronization
requirements. Avoid implying Queue guarantees ordering or completion beyond that
contract.
---
Nitpick comments:
In `@apps/web/src/screens/Profile.tsx`:
- Around line 20-26: Update handleClearLocalData so that, after onClearLocalData
completes for a confirmed action, it shows a brief success alert to the user;
keep the existing confirmation flow and do not alert when the action is
cancelled.
In `@functional-thinking.md.md`:
- Line 49: Revise the “告別手寫迴圈” guideline to prefer the clearest, most readable
collection-processing abstraction rather than requiring map(), filter(), or
reduce(). Explicitly allow loops for early exits, complex control flow, or
effectful operations, and avoid implying that reduce() should sequence side
effects.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 38373bc8-c8d3-4cc3-afc3-7a094b0de4b3
⛔ Files ignored due to path filters (7)
apps/mobile/assets/store/feature-graphic-1024x500.pngis excluded by!**/*.pngapps/mobile/assets/store/screenshot-1.pngis excluded by!**/*.pngapps/mobile/assets/store/screenshot-2.pngis excluded by!**/*.pngapps/mobile/assets/store/screenshot-3.pngis excluded by!**/*.pngapps/mobile/assets/store/screenshot-4.pngis excluded by!**/*.pngapps/mobile/assets/store/screenshot-5.pngis excluded by!**/*.pngyarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (6)
apps/mobile/app.jsonapps/mobile/package.jsonapps/web/src/App.tsxapps/web/src/hooks/useProgress.tsapps/web/src/screens/Profile.tsxfunctional-thinking.md.md
- resetLocalProgress 只在訪客身分才清空記憶體 progress,避免清本機快取時誤將已登入使用者的雲端進度歸零 - 修正登出瞬間的競態:訪客模式寫回 effect 會把切換前的舊 progress 復活寫回 localStorage,蓋掉剛清空的內容,導致刪除帳號後重新登入又被 migrate-local 搬回舊資料 - 登入頁新增「清除本機資料」按鈕,作為額外保險 - 個人資料頁移除使用者 ID 顯示;成長史清單改為彈窗顯示,不再是下方展開 - 修正 functional-thinking 技能筆記三處措辭(防禦性複製、集合處理、協調原語)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Summary by CodeRabbit
New Features
Improvements
Documentation