Conversation
WalkthroughIntroduces a new promisified IndexedDB key-value utility, wires it into Next.js build aliases, and updates Sentry's client beforeSend to derive a candidate message and expand IndexedDB error detection to include that derived message. Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes
Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: defaults Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
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
📜 Review details
Configuration used: defaults
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
instrumentation-client.ts(1 hunks)lib/storage/idb-keyval.ts(1 hunks)next.config.mjs(3 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx}
📄 CodeRabbit inference engine (.cursorrules)
**/*.{ts,tsx,js,jsx}: Do not include any comments in the code; it should be self-explanatory
Write correct, up-to-date, bug-free, fully componentized, secure, and efficient code
Include all required imports and ensure proper naming of key components
Use NextJS features that match the current version
**/*.{ts,tsx,js,jsx}: Replace<img>elements with<Image />fromnext/imageto satisfy@next/next/no-img-elementESLint rule
Use<Link href="/path">from Next.js for internal navigation instead of plain HTML links to satisfy@next/next/no-html-link-for-pagesESLint rule
Files:
instrumentation-client.tslib/storage/idb-keyval.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{js,jsx,ts,tsx}: Code must satisfy ESLint (Next's Core Web Vitals + React Hooks)
Use framework APIs: internal links should use<Link>, images should usenext/image, and adopt Next's ESLint rules (Core Web Vitals)
**/*.{js,jsx,ts,tsx}: Code must satisfy ESLint (Next's Core Web Vitals + React Hooks rules)
Follow existing code style and naming conventions; maintain clean code standards (measured by SonarQube)
Files:
instrumentation-client.tslib/storage/idb-keyval.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{ts,tsx}: Must passtsc --noEmittype checking
Prefer direct named imports for React hooks and types (import { useMemo, useRef, FC, etc. } from "react") overReact.namespace usage (React.useMemo,React.useRef, etc.)
If thereact-hooks/exhaustive-depslint rule is triggered: if the Effect only derives state, remove the Effect and compute during render; if listening to an external system and needing fresh props/state, wrap non-reactive logic inuseEffectEvent
**/*.{ts,tsx}: Must passtsc --noEmitfor TypeScript type checking
Prefer Server Components over Client Components; use Server Functions/Server Actions ('use server') for mutations
Remove unnecessary Effects; if Effect only derives state, compute during render instead
UseuseEffectEventfor non-reactive logic inside Effects to avoid unnecessary re-runs
Use framework APIs:<Link>for internal links,next/imagefor images, adopt Next's ESLint rules
Use'use cache'directive and Cache Components features for explicit opt-in caching in Next.js 16
Use TypeScript and React functional components with hooks
When parsing Seize URLs or similar, fail fast if base origin is unavailable; do not fall back to placeholder origins
Replace<img>elements with<Image />fromnext/image
Use<Link href="/path">for internal navigation instead of plain HTML links
Move data fetches to Server Components; handle mutations through Server Functions/Server Actions with'use server'directive
Files:
instrumentation-client.tslib/storage/idb-keyval.ts
@(instrumentation-client.ts|sentry.server.config.ts|sentry.edge.config.ts)
📄 CodeRabbit inference engine (AGENTS.md)
Errors should be filtered in the Sentry
beforeSendcallback; client-side filtering happens ininstrumentation-client.ts, server-side insentry.server.config.ts, and edge runtime insentry.edge.config.ts
Files:
instrumentation-client.ts
next.config.{js,ts,mjs,mts}
📄 CodeRabbit inference engine (GEMINI.md)
Remove
eslintoptions fromnext.config.*; use ESLint CLI witheslint-config-nextflat config
Files:
next.config.mjs
🧠 Learnings (6)
📚 Learning: 2025-12-03T14:52:34.271Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-12-03T14:52:34.271Z
Learning: Applies to @(instrumentation-client.ts|sentry.server.config.ts|sentry.edge.config.ts) : Errors should be filtered in the Sentry `beforeSend` callback; client-side filtering happens in `instrumentation-client.ts`, server-side in `sentry.server.config.ts`, and edge runtime in `sentry.edge.config.ts`
Applied to files:
instrumentation-client.ts
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Include all required imports and ensure proper naming of key components
Applied to files:
next.config.mjs
📚 Learning: 2025-11-25T08:35:58.729Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T08:35:58.729Z
Learning: Applies to **/*.{ts,tsx,js,jsx} : Use NextJS features that match the current version
Applied to files:
next.config.mjs
📚 Learning: 2025-12-05T10:55:30.871Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-05T10:55:30.871Z
Learning: Applies to **/*.{ts,tsx} : Use `'use cache'` directive and Cache Components features for explicit opt-in caching in Next.js 16
Applied to files:
next.config.mjs
📚 Learning: 2025-12-05T10:55:30.871Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: GEMINI.md:0-0
Timestamp: 2025-12-05T10:55:30.871Z
Learning: Applies to **/*.test.{ts,tsx} : Mock external dependencies and APIs in tests
Applied to files:
next.config.mjs
📚 Learning: 2025-12-05T10:55:43.476Z
Learnt from: CR
Repo: 6529-Collections/6529seize-frontend PR: 0
File: __tests__/AGENTS.md:0-0
Timestamp: 2025-12-05T10:55:43.476Z
Learning: Applies to __tests__/**/*.{ts,tsx,js} : Organize imports with one import per module in order: external → internal → types, with no duplicates
Applied to files:
next.config.mjs
🧬 Code graph analysis (1)
instrumentation-client.ts (1)
utils/error-sanitizer.ts (1)
isIndexedDBError(67-111)
🪛 Biome (2.1.2)
lib/storage/idb-keyval.ts
[error] 345-345: This hook is being called conditionally, but all hooks must be called in the exact same order in every component render.
Hooks should not be called after an early return.
For React to preserve state between calls, hooks needs to be called unconditionally and always in the same order.
See https://reactjs.org/docs/hooks-rules.html#only-call-hooks-at-the-top-level
(lint/correctness/useHookAtTopLevel)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
- GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (6)
next.config.mjs (1)
181-196: LGTM - Webpack and Turbopack aliases correctly configured.The
idb-keyvalalias is properly set up for both bundlers, enabling consistent module resolution across client/server builds. The path styles differ appropriately: absolute for webpack, relative for turbopack.instrumentation-client.ts (1)
166-173: LGTM - Enhanced IndexedDB error detection via derived message.The expanded condition now catches IndexedDB errors from both the error object and the derived message string. This aligns with
isIndexedDBErroraccepting bothErrorandstringtypes, providing more robust error classification. Based on learnings, error filtering inbeforeSendis the correct approach for client-side instrumentation.lib/storage/idb-keyval.ts (4)
1-54: LGTM - Well-structured type definitions and utility functions.The
StoreFntype,RequestLikeinterface, error extraction helpers, andpromisifyRequestare correctly implemented. The error detection patterns align with existing patterns inutils/error-sanitizer.ts.
56-114: LGTM - Robust database connection management with proper cache invalidation.The connection pooling correctly handles
closeandversionchangeevents to invalidate stale connections. Failed connection attempts are properly removed from the cache.
116-154: LGTM - Retry logic for transient database-closing errors.The
createStorefunction correctly implements a single-retry pattern forInvalidStateError/ "database connection is closing" scenarios, which can occur when the database is being upgraded or closed by another tab.
156-288: LGTM - CRUD operations correctly implemented.The operations properly use transaction modes (
readonlyvsreadwrite) and await transaction completion viapromisifyRequest(store.transaction). Theupdatefunction'srejectOncepattern correctly prevents double-rejection.
|



Summary by CodeRabbit
Bug Fixes
Chores
✏️ Tip: You can customize this high-level summary in your review settings.