Fix CSV import notification staying visible after completion#2832
Fix CSV import notification staying visible after completion#2832aaravjaichand wants to merge 1 commit intoappwrite:mainfrom
Conversation
Console (appwrite/console)Project ID: Sites (1)
Tip Functions can run for up to 15 minutes before timing out |
|
No actionable comments were generated in the recent review. 🎉 WalkthroughAdds automatic timed removal of completed or failed CSV import items from the UI using a Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. 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: 1
🤖 Fix all issues with AI agents
In `@src/lib/components/csvImportBox.svelte`:
- Around line 125-141: The auto-removal scheduling is skipped if
showCompletionNotification(databaseId, tableId, importData) rejects; wrap the
await call in a try { await showCompletionNotification(...) } finally { ... }
block so the existing timeout-clear and setTimeout logic (using removalTimeouts,
importItems and importData.$id) always runs; keep the existing
clearTimeout/removalTimeouts.set(...) semantics inside the finally and rethrow
the error after the finally if you want callers to observe failures.
🧹 Nitpick comments (1)
src/lib/components/csvImportBox.svelte (1)
40-45: Trim non-essential comments for removalTimeouts.These comments restate straightforward logic and add noise. Consider removing them to keep comments minimal.
♻️ Suggested cleanup
- /** - * Tracks removal timeouts for completed/failed imports. - * Used to prevent memory leaks and race conditions. - */ let removalTimeouts = new Map<string, ReturnType<typeof setTimeout>>(); @@ - // Clear any existing timeout for this item to prevent race conditions const existingTimeout = removalTimeouts.get(importData.$id); if (existingTimeout) { clearTimeout(existingTimeout); } - // Auto-remove completed/failed items after a delay so users see the result const timeoutId = setTimeout(() => { const next = new Map(importItems); next.delete(importData.$id); importItems = next; removalTimeouts.delete(importData.$id); }, 5000);As per coding guidelines: Use minimal comments; only comment TODOs or complex logic.
Also applies to: 128-135
Auto-remove completed and failed import notifications after 5 seconds. Adds proper timeout tracking to prevent memory leaks and race conditions, with cleanup on component unmount. Fixes appwrite/appwrite#10219
6b01291 to
46cdfcf
Compare

Summary
Related Issue
Fixes #2877
Test Plan
Summary by CodeRabbit