Show reload button when IndexedDB deletion is blocked #39
Summary by CodeRabbit#
- Bug Fixes
- Improved error handling when database operations are blocked due to concurrent activity in other browser tabs
- Added "Reload page" button to help users quickly resolve database conflicts
- Enhanced error messages with clearer guidance on recovery actions
- 1
🚀 Preview Deployment#
Status: ✅ Ready!
Preview URL: Open Preview
Commit:
20374324f41eca826b00806bba22fa76094c7604Built and deployed successfully
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/routes/__root.tsx (1)
116-126: Consider adding visual enhancements for consistency.The reload button implementation correctly provides users with a manual refresh option when database deletion is blocked. The logic is sound and consistent with existing patterns in the codebase.
💡 Optional enhancements for better UX
Consider these improvements for visual consistency and better user experience:
- Add an icon to match the main reset button's style:
<Button className="mx-auto" variant="outline" onClick={() => { window.location.reload(); }} > - Reload page + <RotateCwIcon /> Reload page </Button>- Prevent double-clicks by disabling the button after the first click:
+ const [isReloading, setIsReloading] = useState(false); {showReloadButton && ( <Button className="mx-auto" variant="outline" + disabled={isReloading} onClick={() => { + setIsReloading(true); window.location.reload(); }} > - Reload page + <RotateCwIcon /> {isReloading ? "Reloading..." : "Reload page"} </Button> )}📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📥 Commits
Reviewing files that changed from the base of the PR and between d9d8cbe749bb657558881fc860680409e6480bf3 and 20374324f41eca826b00806bba22fa76094c7604.
📒 Files selected for processing (1)
src/routes/__root.tsx
🧰 Additional context used
📓 Path-based instructions (3)
src/**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (AGENTS.md)
Always ensure no formatting/linting issues exist in code - use
pnpm check --fixto automatically fix issuesFiles:
src/routes/__root.tsx
**/*.{tsx,ts}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer functions over arrow functions for React components
Files:
src/routes/__root.tsx
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
Prefer
typeoverinterfacefor type definitionsFiles:
src/routes/__root.tsx
🧠 Learnings (2)
📚 Learning: 2025-12-24T15:25:07.106Z
Learnt from: fulopkovacs Repo: fulopkovacs/trytanstackdb.com PR: 22 File: src/components/TodoBoards.tsx:63-81 Timestamp: 2025-12-24T15:25:07.106Z Learning: In Tailwind CSS v4, prefer canonical classes using bg-linear-to-* (e.g., bg-linear-to-b, bg-linear-to-t, bg-linear-to-r) over the older bg-gradient-to-* syntax. This aligns with Tailwind LSP's suggestCanonicalClasses rule. Apply across TSX files (e.g., src/components/*.tsx); replace occurrences of bg-gradient-to-* with the corresponding bg-linear-to-* equivalents and verify gradients visually.Applied to files:
src/routes/__root.tsx
📚 Learning: 2025-12-28T23:34:13.416Z
Learnt from: fulopkovacs Repo: fulopkovacs/trytanstackdb.com PR: 32 File: src/components/HomeIntro.tsx:16-25 Timestamp: 2025-12-28T23:34:13.416Z Learning: In Motion (motion/react), when configuring variant transitions, use delayChildren: stagger(x) to create per-child delays (e.g., delayChildren: stagger(0.2)). This is different from the older API that used a separate staggerChildren property. Apply this guidance to TSX files that declare motion variants (e.g., in src/components/**/*.tsx) and verify that stagger is imported from framer-motion. Ensure transitions reflect the intended stagger timing and that no conflicting delay values override the staggered effect.Applied to files:
src/routes/__root.tsx
🧬 Code graph analysis (1)
src/routes/__root.tsx (4)
src/components/ui/button.tsx (1)
Button(63-63)
src/components/EditableProjectDetails.tsx (1)
window(83-85)
src/components/ConfigureDB.tsx (1)
ConfigureDB(23-71)
src/components/ResetTheDbDialog.tsx (1)
ResetTheDbDialog(17-69)
🔇 Additional comments (2)
src/routes/__root.tsx (2)
74-74: LGTM!The state declaration correctly tracks whether the reload button should be displayed. The boolean initialization to
falseis appropriate.
91-93: Code logic and formatting are correct.The onblocked handler properly enables the reload button and provides a clear, helpful error message guiding users to close other tabs or refresh the page. Ensure
pnpm check --fixruns without errors locally before merging.fuko merged this3cf0687
fuko closed this
Sign in to join this conversation.
Walkthrough#
This change adds a reload button UI to handle blocked IndexedDB deletion operations across tabs. When deletion is blocked, a new state tracks this condition and displays an error message with a button that triggers a page refresh.
Changes#
src/routes/__root.tsxshowReloadButtonstate to track blocked deletion operations. On IndexedDB deleteDatabase blocked event, state is set to true and error message is augmented with refresh suggestion. Conditional rendering displays a "Reload page" button that invokeswindow.location.reload().Estimated code review effort#
🎯 2 (Simple) | ⏱️ ~8 minutes
Pre-merge checks and finishing touches#
❌ Failed checks (1 warning)
@coderabbitai generate docstringsto improve docstring coverage.✅ Passed checks (2 passed)
✨ Finishing touches
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.
❤️ Share