Skip to content

Comments

fix timezone issue#1147

Merged
elie222 merged 6 commits intomainfrom
fix/briefs-timezone
Dec 31, 2025
Merged

fix timezone issue#1147
elie222 merged 6 commits intomainfrom
fix/briefs-timezone

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Dec 31, 2025

User description

Format meeting brief prompts and briefing emails in the user's timezone and make About/Digest settings dialogs close on successful save

Introduce timezone-aware formatting via formatDateTimeInUserTimezone and formatTimeInUserTimezone in prompt generation and email sending, and switch About/Digest settings dialogs to controlled components with onSuccess-driven close behavior.

📍Where to Start

Start with buildPrompt in apps/web/utils/ai/meeting-briefs/generate-briefing.ts, then review formatMeetingForContext and the timezone utils in apps/web/utils/date.ts.


📊 Macroscope summarized 3ea9607. 9 files reviewed, 3 issues evaluated, 3 issues filtered, 0 comments posted

🗂️ Filtered Issues

apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx — 0 comments posted, 1 evaluated, 1 filtered
  • line 227: The onSuccess?.() callback at line 227 will be called even when executeItems or executeSchedule fail. The execute() function from useAction (next-safe-action) does not throw on action errors—it handles them via the onError callbacks instead. This means Promise.all() will resolve successfully even when the underlying actions fail, causing the dialog to close and toastSuccess to display alongside the toastError from the individual action error handlers. [ Out of scope ]
apps/web/utils/date.ts — 0 comments posted, 2 evaluated, 2 filtered
  • line 140: If the date parameter passed to formatInUserTimezone is an invalid Date object (e.g., new Date('invalid')), and if TZDate or format throws for invalid dates, the fallback code at line 140-141 will fail with the same error since it uses the same invalid date, causing an unhandled exception. [ Low confidence ]
  • line 141: The catch block in formatInUserTimezone assumes all errors are timezone-related and attempts the same format() call with UTC. If the original error was caused by an invalid formatString parameter, the fallback format(dateInUTC, formatString) on line 141 will also throw the same error, resulting in an unhandled exception escaping the function. [ Low confidence ]

Generated description

Below is a concise technical summary of the changes proposed in this PR:
Implement timezone-aware date formatting across the application to ensure accurate display of event times in user-specific timezones within AI prompts and briefing emails. Refactor existing settings dialogs to operate as controlled components, enhancing UI state management and user experience, alongside minor visual updates to the onboarding flow.

TopicDetails
UI/UX Enhancements Refactor the AboutSetting and DigestSetting dialogs to be controlled components, passing an onSuccess callback to their respective forms (AboutSectionForm, DigestSettingsForm) to manage dialog closure upon successful submission. Additionally, update the BriefsOnboarding component by replacing an icon and adjusting styling for a minor visual enhancement.
Modified files (5)
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/briefs/Onboarding.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
Latest Contributors(1)
UserCommitDate
elie222adjust-uiDecember 31, 2025
Timezone Handling Introduce robust timezone-aware date utility functions using date-fns-tz to correctly format event times based on the user's specified timezone. Integrate these utilities into the meeting brief generation process, ensuring that AI prompts and briefing emails display accurate local times, thereby resolving previous timezone discrepancies.
Modified files (6)
  • apps/web/utils/ai/meeting-briefs/generate-briefing.test.ts
  • apps/web/utils/date.ts
  • apps/web/utils/meeting-briefs/send-briefing.ts
  • apps/web/utils/meeting-briefs/process.ts
  • apps/web/utils/ai/meeting-briefs/generate-briefing.ts
  • apps/web/utils/date.test.ts
Latest Contributors(1)
UserCommitDate
elie222remove-exportDecember 16, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

@vercel
Copy link

vercel bot commented Dec 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Dec 31, 2025 2:28pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 31, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

📝 Walkthrough

Walkthrough

Adds timezone-aware date/time formatting utilities and integrates them into meeting-briefing prompt generation and delivery; updates tests for timezone behavior; changes sendBriefingEmail/buildPrompt signatures; and makes small UI updates (icon swaps and layout) and dialog close-on-success hooks in several settings components.

Changes

Cohort / File(s) Summary
Date utils & tests
apps/web/utils/date.ts, apps/web/utils/date.test.ts
Added formatInUserTimezone, formatTimeInUserTimezone, formatDateTimeInUserTimezone (timezone-aware formatting with TZ handling) and comprehensive tests for multiple zones and edge cases.
Prompt generation & tests
apps/web/utils/ai/meeting-briefs/generate-briefing.ts, apps/web/utils/ai/meeting-briefs/generate-briefing.test.ts
buildPrompt signature extended to accept timezone; GuestContextForPrompt now includes timezone; exported formatMeetingForContext(..., timezone); meeting times formatted via new date utils; tests validate timezone rendering and no-prior-context.
Briefing pipeline
apps/web/utils/meeting-briefs/process.ts, apps/web/utils/meeting-briefs/send-briefing.ts
Propagates emailAccount.timezone into briefing flow; sendBriefingEmail now accepts userTimezone and uses formatTimeInUserTimezone for event time formatting (function signature changed).
Settings dialog close-on-success
apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx, apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx, apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx, apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
Convert several Dialogs to controlled pattern with local open state and pass optional onSuccess?: () => void to form components; forms invoke onSuccess after successful save to close dialogs.
Onboarding UI
apps/web/app/(app)/[emailAccountId]/briefs/Onboarding.tsx
Swapped several icons (e.g., UserIconUserSearchIcon, other icon replacements), added size-4 class to new icons, and changed ItemGroup layout from grid mt-6mt-6.

Sequence Diagram(s)

sequenceDiagram
  %% Participants
  participant Proc as processBriefings (process.ts)
  participant Gen as buildPrompt (generate-briefing.ts)
  participant Date as date utils (date.ts)
  participant Send as sendBriefingEmail (send-briefing.ts)
  participant Email as EmailService

  Proc->>Gen: buildPrompt(briefingData, userTimezone)
  Gen->>Date: formatDateTimeInUserTimezone(meeting.startTime, timezone)
  Date-->>Gen: formatted meeting date/time
  Gen-->>Proc: prompt (timezone-aware)
  Proc->>Send: sendBriefingEmail(payload, userTimezone)
  Send->>Date: formatTimeInUserTimezone(event.startTime, userTimezone)
  Date-->>Send: formattedTime
  Send->>Email: send email with formattedTime and prompt
  Email-->>Send: delivery result
  Send-->>Proc: result
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • anakarentorosserrano-star
  • baz-reviewer

Poem

🐰 I hopped through clocks from here to there,
Sao Paulo, Tokyo, timezones everywhere.
Briefs now speak local, tidy and bright,
Dialogs close gently after a save delight —
Icons swapped, tests green, carrots for the night 🥕✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.29% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title "fix timezone issue" is vague and generic, using a non-descriptive term that doesn't convey the specific nature of the changes or the primary objective of the PR. Use a more specific title that captures the main change, such as "Make meeting briefs timezone-aware" or "Add timezone support to meeting briefs and email formatting".
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ Finishing touches
  • 📝 Generate docstrings

📜 Recent 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 da26ab1 and 3ea9607.

📒 Files selected for processing (6)
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/utils/date.test.ts
  • apps/web/utils/date.ts
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/web/utils/date.ts
  • apps/web/utils/date.test.ts
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)

**/*.{ts,tsx}: For API GET requests to server, use the swr package
Use result?.serverError with toastError from @/components/Toast for error handling in async operations

**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls

**/*.{ts,tsx}: For early access feature flags, create hooks using the naming convention use[FeatureName]Enabled that return a boolean from useFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming convention use[FeatureName]Variant that define variant types, use useFeatureFlagVariantKey() with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g., inbox-cleaner, pricing-options-2)
Always define types for A/B test variant flags (e.g., type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Don't export imported variables
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions
Don't use TypeScript namespaces
Don't use non-null assertions with the ! postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Use as const instead of literal types and type annotations
Use either T[] or Array<T> consistently
Initialize each enum member value explicitly
Use export type for types
Use `impo...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/app/(app)/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)

apps/web/app/(app)/**/*.{ts,tsx}: Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
If we're in a deeply nested component we will use swr to fetch via API
If you need to use onClick in a component, that component is a client component and file must start with use client

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)

Always import Prisma enums from @/generated/prisma/enums instead of @/generated/prisma/client to avoid Next.js bundling errors in client components

Import Prisma using the project's centralized utility: import prisma from '@/utils/prisma'

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Do not export types/interfaces that are only used within the same file. Export later if needed

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Use next/image package for images
For API GET requests to server, use the swr package with hooks like useSWR to fetch data
For text inputs, use the Input component with registerProps for form integration and error handling

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{tsx,ts,css}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

Implement responsive design with Tailwind CSS using a mobile-first approach

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.tsx: Use the LoadingContent component to handle loading states instead of manual loading state management
For text areas, use the Input component with type='text', autosizeTextarea prop set to true, and registerProps for form integration

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{js,jsx,ts,tsx}: Don't use accessKey attribute on any HTML element
Don't set aria-hidden="true" on focusable elements
Don't add ARIA roles, states, and properties to elements that don't support them
Don't use distracting elements like <marquee> or <blink>
Only use the scope prop on <th> elements
Don't assign non-interactive ARIA roles to interactive HTML elements
Make sure label elements have text content and are associated with an input
Don't assign interactive ARIA roles to non-interactive HTML elements
Don't assign tabIndex to non-interactive HTML elements
Don't use positive integers for tabIndex property
Don't include "image", "picture", or "photo" in img alt prop
Don't use explicit role property that's the same as the implicit/default role
Make static elements with click handlers use a valid role attribute
Always include a title element for SVG elements
Give all elements requiring alt text meaningful information for screen readers
Make sure anchors have content that's accessible to screen readers
Assign tabIndex to non-interactive HTML elements with aria-activedescendant
Include all required ARIA attributes for elements with ARIA roles
Make sure ARIA properties are valid for the element's supported roles
Always include a type attribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden)
Always include a lang attribute on the html element
Always include a title attribute for iframe elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Include caption tracks for audio and video elements
Use semantic elements instead of role attributes in JSX
Make sure all anchors are valid and navigable
Ensure all ARIA properties (aria-*) are valid
Use valid, non-abstract ARIA roles for elements with ARIA roles
Use valid AR...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
Don't use the return value of React.render
Make sure all dependencies are correctly specified in React hooks
Make sure all React hooks are called from the top level of component functions
Don't forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use both children and dangerouslySetInnerHTML props on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use <>...</> instead of <Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't use target="_blank" without rel="noopener"
Don't use <img> elements in Next.js projects
Don't use <head> elements in Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
!(pages/_document).{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

Don't use the next/head module in pages/_document.js on Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)

**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx,js,jsx}: Use @/ path aliases for imports from project root
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Follow NextJS app router structure with (app) directory

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{tsx,jsx}: Follow tailwindcss patterns with prettier-plugin-tailwindcss for class sorting
Prefer functional components with hooks in React
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach in components
Follow consistent naming conventions using PascalCase for components
Use LoadingContent component for async data with loading and error states
Use React Hook Form with Zod validation for form handling
Use result?.serverError with toastError and toastSuccess for error handling in forms

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
apps/web/**/*.{ts,tsx,js,jsx,json,css}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Format code with Prettier

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
**/*Form.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)

**/*Form.{ts,tsx}: Use React Hook Form with Zod for validation in form components
Validate form inputs before submission
Show validation errors inline next to form fields

Files:

  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
🧠 Learnings (11)
📚 Learning: 2025-07-17T04:19:57.099Z
Learnt from: edulelis
Repo: elie222/inbox-zero PR: 576
File: packages/resend/emails/digest.tsx:78-83
Timestamp: 2025-07-17T04:19:57.099Z
Learning: In packages/resend/emails/digest.tsx, the DigestEmailProps type uses `[key: string]: DigestItem[] | undefined | string | Date | undefined` instead of intersection types like `& Record<string, DigestItem[] | undefined>` due to implementation constraints. This was the initial implementation approach and cannot be changed to more restrictive typing.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Components with `onClick` handlers must be client components marked with the `use client` directive

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : If you need to use `onClick` in a component, that component must be a client component and file must start with `use client` directive

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/**/*.{ts,tsx} : If you need to use `onClick` in a component, that component is a client component and file must start with `use client`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*Form*.tsx : Handle form submission results using `result?.serverError` to show error toasts and `toastSuccess` to show success messages after server action completion

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:42:08.869Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ultracite.mdc:0-0
Timestamp: 2025-11-25T14:42:08.869Z
Learning: Applies to **/*.{jsx,tsx} : Make sure all dependencies are correctly specified in React hooks

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
📚 Learning: 2024-08-23T11:37:26.779Z
Learnt from: aryanprince
Repo: elie222/inbox-zero PR: 210
File: apps/web/app/(app)/stats/NewsletterModal.tsx:2-4
Timestamp: 2024-08-23T11:37:26.779Z
Learning: `MoreDropdown` is a React component and `useUnsubscribeButton` is a custom React hook, and they should not be imported using `import type`.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use `result?.serverError` with `toastError` and `toastSuccess` for error handling in forms

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-07-08T13:14:07.449Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 537
File: apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx:30-34
Timestamp: 2025-07-08T13:14:07.449Z
Learning: The clean onboarding page in apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx is intentionally Gmail-specific and should show an error for non-Google email accounts rather than attempting to support multiple providers.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use LoadingContent component for async data with loading and error states

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:40.146Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/data-fetching.mdc:0-0
Timestamp: 2025-11-25T14:36:40.146Z
Learning: Applies to **/*.{ts,tsx} : Use `result?.serverError` with `toastError` from `@/components/Toast` for error handling in async operations

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
🧬 Code graph analysis (4)
apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx (2)
apps/web/components/SettingCard.tsx (1)
  • SettingCard (3-34)
apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx (1)
  • DigestSettingsForm (61-343)
apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx (1)
apps/web/components/Toast.tsx (1)
  • toastError (14-19)
apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx (2)
apps/web/components/SettingCard.tsx (1)
  • SettingCard (3-34)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)
  • AboutSection (42-58)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)
apps/web/components/LoadingContent.tsx (1)
  • LoadingContent (13-31)
⏰ 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). (4)
  • GitHub Check: Baz Reviewer
  • GitHub Check: test
  • GitHub Check: Analyze (javascript-typescript)
  • GitHub Check: Macroscope - Correctness Check
🔇 Additional comments (9)
apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx (2)

3-3: LGTM! Proper controlled dialog implementation.

The introduction of local state and the controlled dialog pattern is correctly implemented. This allows the parent component to programmatically control dialog visibility.

Also applies to: 17-18


24-24: LGTM! Controlled dialog with onSuccess callback.

The Dialog is now controlled via open and onOpenChange props, and the onSuccess callback properly closes the dialog after a successful form submission. This pattern is consistent with similar changes in AboutSetting.tsx.

Also applies to: 39-39

apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx (3)

61-61: LGTM! Proper callback prop signature.

The optional onSuccess callback is correctly typed and follows the established pattern for post-submission hooks.


227-227: LGTM! Callback invoked at the right time.

The onSuccess callback is correctly invoked after both digest updates complete successfully, using optional chaining for safety.


235-235: LGTM! Dependency array is now complete.

The onSuccess callback has been correctly added to the dependency array, resolving the stale closure issue flagged in the previous review.

apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx (2)

3-3: LGTM! Consistent with DigestSetting pattern.

The controlled dialog implementation follows the same pattern as DigestSetting.tsx, maintaining consistency across settings components.

Also applies to: 17-18


24-24: LGTM! Controlled dialog with onSuccess callback.

The Dialog is properly controlled and the onSuccess callback is correctly passed to AboutSection to close the dialog after successful submission. This maintains consistency with the DigestSetting implementation.

Also applies to: 39-39

apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (2)

42-42: LGTM! Proper prop threading.

The onSuccess callback is correctly accepted by AboutSection and properly passed down to AboutSectionForm, maintaining type consistency throughout the component hierarchy.

Also applies to: 51-55


63-63: LGTM! Callback correctly invoked after successful save.

The onSuccess callback is properly typed, destructured, and invoked after the successful toast notification, following the same pattern as DigestSettingsForm.tsx.

Also applies to: 67-67, 87-87


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

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 7 files

Comment on lines 118 to 125
export function formatInUserTimezone(
date: Date,
timezone: string | null | undefined,
formatString: string,
): string {
const tz = timezone || DEFAULT_TIMEZONE;
const dateInTZ = new TZDate(date, tz);
return format(dateInTZ, formatString);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TZDate will throw on corrupted/legacy/non-IANA values since the only validation is z.string().min(1). Could we validate or catch exceptions to avoid breaking prompts/emails?


Finding type: Logical Bugs

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 9d090ba addressed this comment by wrapping the TZDate creation in a try-catch block that catches exceptions from corrupted/legacy/non-IANA timezone values. When an invalid timezone is encountered, the code now logs the error and gracefully falls back to UTC instead of throwing an exception that could break prompts/emails.

Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 4 files (changes from recent commits).

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx">

<violation number="1" location="apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx:227">
P2: Missing `onSuccess` in `useCallback` dependency array. The `onSuccess` prop is used inside the `onSubmit` callback but is not listed in the dependency array `[rules, executeItems, executeSchedule]`. This will cause stale closure issues if the parent component provides a different `onSuccess` callback on re-render.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

toastSuccess({
description: "Your digest settings have been updated!",
});
onSuccess?.();
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot Dec 31, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Missing onSuccess in useCallback dependency array. The onSuccess prop is used inside the onSubmit callback but is not listed in the dependency array [rules, executeItems, executeSchedule]. This will cause stale closure issues if the parent component provides a different onSuccess callback on re-render.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx, line 227:

<comment>Missing `onSuccess` in `useCallback` dependency array. The `onSuccess` prop is used inside the `onSubmit` callback but is not listed in the dependency array `[rules, executeItems, executeSchedule]`. This will cause stale closure issues if the parent component provides a different `onSuccess` callback on re-render.</comment>

<file context>
@@ -224,6 +224,7 @@ export function DigestSettingsForm() {
         toastSuccess({
           description: &quot;Your digest settings have been updated!&quot;,
         });
+        onSuccess?.();
       } catch {
         toastError({
</file context>

✅ Addressed in 3ea9607

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit 3ea9607 addressed this comment by adding onSuccess to the useCallback dependency array. The dependency array was updated from [rules, executeItems, executeSchedule] to [rules, executeItems, executeSchedule, onSuccess], which resolves the stale closure issue that was identified.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx (1)

173-236: Add onSuccess to the useCallback dependency array.

The onSuccess callback is invoked at line 227 but is missing from the dependency array at line 235. This violates the React Hook exhaustive-deps rule and could lead to stale closures if the parent component changes the callback reference.

🔎 Proposed fix
     [rules, executeItems, executeSchedule],
+    [rules, executeItems, executeSchedule, onSuccess],
   );
📜 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 da26ab1 and 1f082f7.

📒 Files selected for processing (4)
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
🧰 Additional context used
📓 Path-based instructions (16)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/data-fetching.mdc)

**/*.{ts,tsx}: For API GET requests to server, use the swr package
Use result?.serverError with toastError from @/components/Toast for error handling in async operations

**/*.{ts,tsx}: Use wrapper functions for Gmail message operations (get, list, batch, etc.) from @/utils/gmail/message.ts instead of direct API calls
Use wrapper functions for Gmail thread operations from @/utils/gmail/thread.ts instead of direct API calls
Use wrapper functions for Gmail label operations from @/utils/gmail/label.ts instead of direct API calls

**/*.{ts,tsx}: For early access feature flags, create hooks using the naming convention use[FeatureName]Enabled that return a boolean from useFeatureFlagEnabled("flag-key")
For A/B test variant flags, create hooks using the naming convention use[FeatureName]Variant that define variant types, use useFeatureFlagVariantKey() with type casting, and provide a default "control" fallback
Use kebab-case for PostHog feature flag keys (e.g., inbox-cleaner, pricing-options-2)
Always define types for A/B test variant flags (e.g., type PricingVariant = "control" | "variant-a" | "variant-b") and provide type safety through type casting

**/*.{ts,tsx}: Don't use primitive type aliases or misleading types
Don't use empty type parameters in type aliases and interfaces
Don't use this and super in static contexts
Don't use any or unknown as type constraints
Don't use the TypeScript directive @ts-ignore
Don't use TypeScript enums
Don't export imported variables
Don't add type annotations to variables, parameters, and class properties that are initialized with literal expressions
Don't use TypeScript namespaces
Don't use non-null assertions with the ! postfix operator
Don't use parameter properties in class constructors
Don't use user-defined types
Use as const instead of literal types and type annotations
Use either T[] or Array<T> consistently
Initialize each enum member value explicitly
Use export type for types
Use `impo...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/app/(app)/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/page-structure.mdc)

apps/web/app/(app)/**/*.{ts,tsx}: Components for the page are either put in page.tsx, or in the apps/web/app/(app)/PAGE_NAME folder
If we're in a deeply nested component we will use swr to fetch via API
If you need to use onClick in a component, that component is a client component and file must start with use client

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/prisma-enum-imports.mdc)

Always import Prisma enums from @/generated/prisma/enums instead of @/generated/prisma/client to avoid Next.js bundling errors in client components

Import Prisma using the project's centralized utility: import prisma from '@/utils/prisma'

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/project-structure.mdc)

Import specific lodash functions rather than entire lodash library to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

apps/web/**/*.{ts,tsx}: Use TypeScript with strict null checks
Do not export types/interfaces that are only used within the same file. Export later if needed

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.{tsx,ts}: Use Shadcn UI and Tailwind for components and styling
Use next/image package for images
For API GET requests to server, use the swr package with hooks like useSWR to fetch data
For text inputs, use the Input component with registerProps for form integration and error handling

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{tsx,ts,css}

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

Implement responsive design with Tailwind CSS using a mobile-first approach

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/ui-components.mdc)

**/*.tsx: Use the LoadingContent component to handle loading states instead of manual loading state management
For text areas, use the Input component with type='text', autosizeTextarea prop set to true, and registerProps for form integration

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{js,jsx,ts,tsx}: Don't use accessKey attribute on any HTML element
Don't set aria-hidden="true" on focusable elements
Don't add ARIA roles, states, and properties to elements that don't support them
Don't use distracting elements like <marquee> or <blink>
Only use the scope prop on <th> elements
Don't assign non-interactive ARIA roles to interactive HTML elements
Make sure label elements have text content and are associated with an input
Don't assign interactive ARIA roles to non-interactive HTML elements
Don't assign tabIndex to non-interactive HTML elements
Don't use positive integers for tabIndex property
Don't include "image", "picture", or "photo" in img alt prop
Don't use explicit role property that's the same as the implicit/default role
Make static elements with click handlers use a valid role attribute
Always include a title element for SVG elements
Give all elements requiring alt text meaningful information for screen readers
Make sure anchors have content that's accessible to screen readers
Assign tabIndex to non-interactive HTML elements with aria-activedescendant
Include all required ARIA attributes for elements with ARIA roles
Make sure ARIA properties are valid for the element's supported roles
Always include a type attribute for button elements
Make elements with interactive roles and handlers focusable
Give heading elements content that's accessible to screen readers (not hidden with aria-hidden)
Always include a lang attribute on the html element
Always include a title attribute for iframe elements
Accompany onClick with at least one of: onKeyUp, onKeyDown, or onKeyPress
Accompany onMouseOver/onMouseOut with onFocus/onBlur
Include caption tracks for audio and video elements
Use semantic elements instead of role attributes in JSX
Make sure all anchors are valid and navigable
Ensure all ARIA properties (aria-*) are valid
Use valid, non-abstract ARIA roles for elements with ARIA roles
Use valid AR...

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

**/*.{jsx,tsx}: Don't use unnecessary fragments
Don't pass children as props
Don't use the return value of React.render
Make sure all dependencies are correctly specified in React hooks
Make sure all React hooks are called from the top level of component functions
Don't forget key props in iterators and collection literals
Don't define React components inside other components
Don't use event handlers on non-interactive elements
Don't assign to React component props
Don't use both children and dangerouslySetInnerHTML props on the same element
Don't use dangerous JSX props
Don't use Array index in keys
Don't insert comments as text nodes
Don't assign JSX properties multiple times
Don't add extra closing tags for components without children
Use <>...</> instead of <Fragment>...</Fragment>
Watch out for possible "wrong" semicolons inside JSX elements
Make sure void (self-closing) elements don't have children
Don't use target="_blank" without rel="noopener"
Don't use <img> elements in Next.js projects
Don't use <head> elements in Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
!(pages/_document).{jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/ultracite.mdc)

Don't use the next/head module in pages/_document.js on Next.js projects

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursor/rules/utilities.mdc)

**/*.{js,ts,jsx,tsx}: Use lodash utilities for common operations (arrays, objects, strings)
Import specific lodash functions to minimize bundle size (e.g., import groupBy from 'lodash/groupBy')

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{ts,tsx,js,jsx}: Use @/ path aliases for imports from project root
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/app/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Follow NextJS app router structure with (app) directory

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

apps/web/**/*.{tsx,jsx}: Follow tailwindcss patterns with prettier-plugin-tailwindcss for class sorting
Prefer functional components with hooks in React
Use shadcn/ui components when available
Ensure responsive design with mobile-first approach in components
Follow consistent naming conventions using PascalCase for components
Use LoadingContent component for async data with loading and error states
Use React Hook Form with Zod validation for form handling
Use result?.serverError with toastError and toastSuccess for error handling in forms

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
apps/web/**/*.{ts,tsx,js,jsx,json,css}

📄 CodeRabbit inference engine (apps/web/CLAUDE.md)

Format code with Prettier

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
**/*Form.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/form-handling.mdc)

**/*Form.{ts,tsx}: Use React Hook Form with Zod for validation in form components
Validate form inputs before submission
Show validation errors inline next to form fields

Files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
🧠 Learnings (10)
📚 Learning: 2025-07-17T04:19:57.099Z
Learnt from: edulelis
Repo: elie222/inbox-zero PR: 576
File: packages/resend/emails/digest.tsx:78-83
Timestamp: 2025-07-17T04:19:57.099Z
Learning: In packages/resend/emails/digest.tsx, the DigestEmailProps type uses `[key: string]: DigestItem[] | undefined | string | Date | undefined` instead of intersection types like `& Record<string, DigestItem[] | undefined>` due to implementation constraints. This was the initial implementation approach and cannot be changed to more restrictive typing.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
📚 Learning: 2025-11-25T14:38:56.992Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/project-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:56.992Z
Learning: Components with `onClick` handlers must be client components marked with the `use client` directive

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:38:18.874Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:18.874Z
Learning: Applies to apps/web/app/(app)/**/*.tsx : If you need to use `onClick` in a component, that component must be a client component and file must start with `use client` directive

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:38:23.265Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/page-structure.mdc:0-0
Timestamp: 2025-11-25T14:38:23.265Z
Learning: Applies to apps/web/app/(app)/**/*.{ts,tsx} : If you need to use `onClick` in a component, that component is a client component and file must start with `use client`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2024-08-23T11:37:26.779Z
Learnt from: aryanprince
Repo: elie222/inbox-zero PR: 210
File: apps/web/app/(app)/stats/NewsletterModal.tsx:2-4
Timestamp: 2024-08-23T11:37:26.779Z
Learning: `MoreDropdown` is a React component and `useUnsubscribeButton` is a custom React hook, and they should not be imported using `import type`.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx
📚 Learning: 2025-11-25T14:37:09.306Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2025-11-25T14:37:09.306Z
Learning: Applies to apps/web/components/**/*Form*.tsx : Handle form submission results using `result?.serverError` to show error toasts and `toastSuccess` to show success messages after server action completion

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
  • apps/web/app/(app)/[emailAccountId]/settings/DigestSettingsForm.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use `result?.serverError` with `toastError` and `toastSuccess` for error handling in forms

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-07-08T13:14:07.449Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 537
File: apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx:30-34
Timestamp: 2025-07-08T13:14:07.449Z
Learning: The clean onboarding page in apps/web/app/(app)/[emailAccountId]/clean/onboarding/page.tsx is intentionally Gmail-specific and should show an error for non-Google email accounts rather than attempting to support multiple providers.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-12-21T12:21:37.794Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2025-12-21T12:21:37.794Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use LoadingContent component for async data with loading and error states

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
📚 Learning: 2025-11-25T14:36:40.146Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/data-fetching.mdc:0-0
Timestamp: 2025-11-25T14:36:40.146Z
Learning: Applies to **/*.{ts,tsx} : Use `result?.serverError` with `toastError` from `@/components/Toast` for error handling in async operations

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx
🧬 Code graph analysis (2)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)
apps/web/components/LoadingContent.tsx (1)
  • LoadingContent (13-31)
apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx (2)
apps/web/components/SettingCard.tsx (1)
  • SettingCard (3-34)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)
  • AboutSection (42-58)
⏰ 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). (2)
  • GitHub Check: Baz Reviewer
  • GitHub Check: Macroscope - Correctness Check
🔇 Additional comments (3)
apps/web/app/(app)/[emailAccountId]/settings/AboutSectionForm.tsx (1)

42-87: LGTM! Clean implementation of optional success callback.

The onSuccess callback pattern is well-implemented:

  • Optional prop maintains backward compatibility
  • Called after success toast but before mutation, allowing dialog closure
  • Properly propagated through component hierarchy
apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx (1)

3-39: LGTM! Controlled dialog pattern correctly implemented.

The conversion to a controlled dialog with success callback follows React best practices and aligns with the pattern used in AboutSetting.tsx.

apps/web/app/(app)/[emailAccountId]/assistant/settings/AboutSetting.tsx (1)

3-39: LGTM! Consistent controlled dialog implementation.

The changes follow the same clean pattern as DigestSetting.tsx, converting to a controlled dialog with a success callback for proper state management.

Comment on lines +147 to +152
it("should handle legacy timezone abbreviations that TZDate supports", () => {
const result = formatTimeInUserTimezone(utcDate, "EST");
// TZDate supports some legacy abbreviations like "EST" (UTC-5)
// 7 PM UTC = 2 PM EST
expect(result).toBe("2:00 PM");
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TZDate only accepts canonical IANA zone names (per @date-fns/tz docs) or numeric offsets, not legacy abbreviations like "EST". Passing "EST" triggers the catch block, so formatTimeInUserTimezone falls back to UTC ("7:00 PM") instead of 2:00 PM, making this test fail and mismatching production behavior in environments where Intl rejects the shorthand.

Suggested change
it("should handle legacy timezone abbreviations that TZDate supports", () => {
const result = formatTimeInUserTimezone(utcDate, "EST");
// TZDate supports some legacy abbreviations like "EST" (UTC-5)
// 7 PM UTC = 2 PM EST
expect(result).toBe("2:00 PM");
});

Finding type: Logical Bugs

@elie222 elie222 merged commit 3ea9607 into main Dec 31, 2025
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant