Skip to content

feat: add toggle to Digest setting#1255

Merged
elie222 merged 3 commits intomainfrom
feat/digest-toggle-ui
Jan 11, 2026
Merged

feat: add toggle to Digest setting#1255
elie222 merged 3 commits intomainfrom
feat/digest-toggle-ui

Conversation

@elie222
Copy link
Owner

@elie222 elie222 commented Jan 11, 2026

User description

Add toggle + Configure button UI to Digest setting, matching Follow-up reminders pattern.

  • When enabled: creates daily 9am schedule, adds DIGEST action to Newsletter rule
  • When disabled: deletes schedule
  • Add loading skeleton to prevent flash on both Digest and Follow-up settings
  • Extract buildScheduleCreateData helper for DRY schedule creation

🤖 Generated with Claude Code


Generated description

Below is a concise technical summary of the changes proposed in this PR:

graph LR
DigestSetting_("DigestSetting"):::modified
NEXT_SAFE_ACTION_("NEXT_SAFE_ACTION"):::modified
toggleDigestAction_("toggleDigestAction"):::added
toggleDigestBody_("toggleDigestBody"):::added
SCHEDULE_UTILS_("SCHEDULE_UTILS"):::modified
PRISMA_("PRISMA"):::modified
DigestSetting_ -- "Triggers toggleDigestAction sending emailAccountId and enabled flag." --> NEXT_SAFE_ACTION_
NEXT_SAFE_ACTION_ -- "Executes action with {enabled} payload for account." --> toggleDigestAction_
toggleDigestAction_ -- "Validates incoming payload's enabled boolean." --> toggleDigestBody_
toggleDigestAction_ -- "Creates default schedule timing (timeOfDay, nextOccurrence)." --> SCHEDULE_UTILS_
toggleDigestAction_ -- "Upserts schedule row with default interval, days, nextOccurrence." --> PRISMA_
toggleDigestAction_ -- "Ensures newsletter rule has DIGEST action, inserts if missing." --> PRISMA_
toggleDigestAction_ -- "Deletes existing schedule rows for the email account." --> PRISMA_
classDef added stroke:#15AA7A
classDef removed stroke:#CD5270
classDef modified stroke:#EDAC4C
linkStyle default stroke:#CBD5E1,font-size:13px
Loading

Introduces a toggle and configure button to the DigestSetting UI, aligning its user experience with the FollowUpRemindersSetting component. Implements backend logic in toggleDigestAction to create a daily 9 am digest schedule and associate a DIGEST action with the newsletter rule when enabled, or delete the schedule when disabled.

TopicDetails
Digest UI & UX Adds a toggle and a conditional 'Configure' button to the DigestSetting component, allowing users to enable/disable and customize their email digest schedule. Applies a loading Skeleton to both DigestSetting and FollowUpRemindersSetting to improve UI responsiveness during data fetching.
Modified files (2)
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
Latest Contributors(2)
UserCommitDate
elie222refactor-extract-scan-...January 11, 2026
joshwerner001@gmail.comFixes-with-setting-up-...January 08, 2026
Digest Backend Logic Implements the toggleDigestAction to manage the backend state of the digest feature. When enabled, it creates a daily 9 am schedule and ensures a DIGEST action is added to the NEWSLETTER rule; when disabled, it deletes the associated schedule. Also adds validation for the new action via toggleDigestBody.
Modified files (2)
  • apps/web/utils/actions/settings.ts
  • apps/web/utils/actions/settings.validation.ts
Latest Contributors(2)
UserCommitDate
elie222fix-address-PR-review-...January 08, 2026
eduardoleliss@gmail.comDigest-email-fixesJuly 07, 2025
This pull request is reviewed by Baz. Review like a pro on (Baz).

- Add toggle + Configure button UI to Digest setting
- Create toggleDigestAction to enable/disable digest
- When enabled: creates daily 9am schedule, adds DIGEST action to Newsletter rule
- When disabled: deletes schedule
- Add loading skeleton to prevent flash on both Digest and Follow-up settings
- Extract buildScheduleCreateData helper and DEFAULT_DIGEST_SCHEDULE constant

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@vercel
Copy link

vercel bot commented Jan 11, 2026

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

Project Deployment Review Updated (UTC)
inbox-zero Ready Ready Preview Jan 11, 2026 8:00pm

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 11, 2026

📝 Walkthrough

Walkthrough

This PR adds loading states to digest and follow-up reminder settings, introduces a new toggleDigestAction server action to enable/disable digest schedules with optimistic UI updates and error handling, and refactors components to conditionally render controls based on loading status.

Changes

Cohort / File(s) Summary
UI Components with Loading States
apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx, apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
Added Skeleton loaders while useEmailAccountFull data is loading; refactored DigestSetting to conditionally render Configure Dialog and Toggle based on digestSchedule presence; added optimistic UI updates for toggle with error recovery via mutate().
Toggle Digest Action & Validation
apps/web/utils/actions/settings.ts, apps/web/utils/actions/settings.validation.ts
Introduced toggleDigestAction server action: enables digest by creating/upserting default schedule and DIGEST rule action, disables by deleting all schedules; added corresponding toggleDigestBody validation schema with enabled boolean.

Sequence Diagram(s)

sequenceDiagram
    participant User as User
    participant UI as DigestSetting UI
    participant Action as toggleDigestAction
    participant DB as Database
    participant Hook as useEmailAccountFull

    User->>UI: Click Toggle
    UI->>UI: Set optimistic state
    UI->>Action: Call toggleDigestAction({ enabled })
    
    alt Enable Digest
        Action->>DB: Upsert digest schedule
        Action->>DB: Create/ensure DIGEST action
        Action->>DB: Calculate nextOccurrenceAt
    else Disable Digest
        Action->>DB: Delete all digest schedules
    end
    
    alt Success
        DB-->>Action: Success response
        Action-->>UI: { success: true }
        UI->>Hook: mutate() refresh data
        Hook-->>UI: Updated data
    else Error
        DB-->>Action: Error
        Action-->>UI: Error thrown
        UI->>UI: Show error toast
        UI->>Hook: mutate() refresh data
        Hook-->>UI: Restore previous state
    end
Loading

Estimated Code Review Effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly Related PRs

  • Extract digest to its own toggle #718: Implements digest toggle extraction from rule actions with dedicated UI and backend handling—directly aligned with this PR's toggle feature additions.
  • Fix Digest emails #547: Adds ensureDefaultDigestScheduleAction in the same settings.ts file—related server action for digest schedule initialization.
  • fix timezone issue #1147: Previously modified DigestSetting.tsx with controlled Dialog flow—this PR builds upon that component with loading states and toggle behavior.

Poem

🐰 A toggle so grand, digest now at hand,
With loading states styled, our UI so styled!
Optimistic hops render, no data we render,
When error we stumble, refresh makes us nimble! 🎯

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a toggle to the Digest setting component, which is the primary focus of the PR.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

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.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 issues found across 4 files

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]/assistant/settings/DigestSetting.tsx">

<violation number="1" location="apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx:26">
P2: `enabled` defaults to true while account data is still loading (or failed), so the Digest toggle and Configure button incorrectly render as enabled even though the real state is unknown and interactions are ignored. Default to false until `digestSchedule` is actually present.</violation>
</file>

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

<violation number="1" location="apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx:114">
P2: Disable the toggle when account data is unavailable so the control doesn’t appear clickable while `handleToggle` is a no-op.</violation>
</file>

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

- Fix enabled state to use != null (handles undefined correctly)
- Add disabled prop to follow-up reminders toggle when data unavailable

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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: 1

🤖 Fix all issues with AI agents
In @apps/web/utils/actions/settings.ts:
- Around line 155-201: toggleDigestAction and updateDigestScheduleAction perform
prisma.schedule mutations but don't call revalidatePath to invalidate the UI
cache; after each schedule-changing operation (the upsert and delete in
toggleDigestAction and the update in updateDigestScheduleAction) call
revalidatePath with your settings page route (e.g. revalidatePath("/settings"))
to revalidate the cache, and add the appropriate import for revalidatePath (from
next/cache or your routing util).
🧹 Nitpick comments (2)
apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx (1)

59-90: Add disabled prop to the Toggle component.

The Toggle component should have a disabled={!data} prop to prevent interaction when data is unavailable, matching the pattern in FollowUpRemindersSetting.tsx (line 118).

♻️ Suggested fix
             <Toggle
               name="digest-enabled"
               enabled={enabled}
               onChange={handleToggle}
+              disabled={!data}
             />
apps/web/utils/actions/settings.ts (1)

167-179: Consider whether the empty update object is intentional.

The upsert uses an empty update: {} object (line 178), meaning if a schedule already exists, enabling digest won't modify it. This could preserve user customizations, but it might be unexpected if the user disabled and then re-enabled digest - they might expect it to reset to defaults.

If the intent is to reset to defaults on re-enable:

♻️ Alternative approach
       await prisma.schedule.upsert({
         where: { emailAccountId },
         create: {
           emailAccountId,
           ...defaultSchedule,
           lastOccurrenceAt: new Date(),
           nextOccurrenceAt: calculateNextScheduleDate({
             ...defaultSchedule,
             lastOccurrenceAt: null,
           }),
         },
-        update: {},
+        update: {
+          ...defaultSchedule,
+          lastOccurrenceAt: new Date(),
+          nextOccurrenceAt: calculateNextScheduleDate({
+            ...defaultSchedule,
+            lastOccurrenceAt: null,
+          }),
+        },
       });
📜 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 6567abc and c7b7fa1.

📒 Files selected for processing (4)
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
  • apps/web/utils/actions/settings.ts
  • apps/web/utils/actions/settings.validation.ts
🧰 Additional context used
📓 Path-based instructions (25)
**/*.{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}: 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 import type for types
Make sure all enum members are literal values
Don't use TypeScript const enum
Don't declare empty interfaces
Don't let variables evolve into any type through reassignments
Don't use the any type
Don't misuse the non-null assertion operator (!) in TypeScript files
Don't use implicit any type on variable declarations
Don't merge interfaces and classes unsafely
Don't use overload signatures that aren't next to each other
Use the namespace keyword instead of the module keyword to declare TypeScript namespaces
Use consistent accessibility modifiers on class properties and methods
Use function types instead of object types wit...

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
**/*.validation.{ts,tsx}

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

**/*.validation.{ts,tsx}: Define validation schemas using Zod
Use descriptive error messages in validation schemas

Files:

  • apps/web/utils/actions/settings.validation.ts
**/*.{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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
apps/web/utils/actions/**/*.ts

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

apps/web/utils/actions/**/*.ts: Server actions must be located in apps/web/utils/actions folder
Server action files must start with use server directive

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
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
Infer types from Zod schemas using z.infer<typeof schema> instead of duplicating as separate interfaces

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
**/*.ts

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

**/*.ts: ALL database queries MUST be scoped to the authenticated user/account by including user/account filtering in WHERE clauses to prevent unauthorized data access
Always validate that resources belong to the authenticated user before performing operations, using ownership checks in WHERE clauses or relationships
Always validate all input parameters for type, format, and length before using them in database queries
Use SafeError for error responses to prevent information disclosure. Generic error messages should not reveal internal IDs, logic, or resource ownership details
Only return necessary fields in API responses using Prisma's select option. Never expose sensitive data such as password hashes, private keys, or system flags
Prevent Insecure Direct Object References (IDOR) by validating resource ownership before operations. All findUnique/findFirst calls MUST include ownership filters
Prevent mass assignment vulnerabilities by explicitly whitelisting allowed fields in update operations instead of accepting all user-provided data
Prevent privilege escalation by never allowing users to modify system fields, ownership fields, or admin-only attributes through user input
All findMany queries MUST be scoped to the user's data by including appropriate WHERE filters to prevent returning data from other users
Use Prisma relationships for access control by leveraging nested where clauses (e.g., emailAccount: { id: emailAccountId }) to validate ownership

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
apps/web/utils/actions/*.validation.ts

📄 CodeRabbit inference engine (.cursor/rules/server-actions.mdc)

apps/web/utils/actions/*.validation.ts: Create separate validation files for server actions using the naming convention apps/web/utils/actions/NAME.validation.ts containing Zod schemas and inferred types
Define input validation schemas using Zod in .validation.ts files and export both the schema and its inferred TypeScript type

Validation schemas should be in separate files (e.g., utils/actions/example.validation.ts)

Files:

  • apps/web/utils/actions/settings.validation.ts
apps/web/utils/actions/*.ts

📄 CodeRabbit inference engine (.cursor/rules/server-actions.mdc)

apps/web/utils/actions/*.ts: Create corresponding server action implementation files using the naming convention apps/web/utils/actions/NAME.ts with 'use server' directive
Use 'use server' directive at the top of server action implementation files
Implement all server actions using the next-safe-action library with actionClient, actionClientUser, or adminActionClient for type safety and validation
Use actionClientUser when only authenticated user context (userId) is needed
Use actionClient when both authenticated user context and a specific emailAccountId are needed, with emailAccountId bound when calling from the client
Use adminActionClient for actions restricted to admin users
Add metadata with a meaningful action name using .metadata({ name: "actionName" }) for Sentry instrumentation and monitoring
Use .schema() method with Zod validation schemas from corresponding .validation.ts files in next-safe-action configuration
Access context (userId, emailAccountId, etc.) via the ctx object parameter in the .action() handler
Use revalidatePath or revalidateTag from 'next/cache' within server action handlers when mutations modify data displayed elsewhere

apps/web/utils/actions/*.ts: Use next-safe-action with proper Zod validation for server actions
Server actions should use actionClient.metadata({ name: 'actionName' }).schema(schema).action(...) pattern
Call revalidatePath in server actions after successful mutations
Use revalidatePath in server actions for cache invalidation

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
**/*.{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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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')

**/*.{js,ts,jsx,tsx}: 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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
**/{utils,helpers,lib}/**/*.{ts,tsx}

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

Logger should be passed as a parameter to helper functions instead of creating their own logger instances

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
apps/web/utils/actions/**/*.validation.ts

📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)

Create Zod validation schemas at apps/web/utils/actions/{feature}.validation.ts for all server action input validation

Files:

  • apps/web/utils/actions/settings.validation.ts
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
Use proper error handling with try/catch blocks
Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments. Never add comments that just describe what the code does. Only add comments for 'why' not 'what'
Add helper functions to the bottom of files, not the top
All imports go at the top of files, no mid-file dynamic imports
Use getActionErrorMessage(error.error) from @/utils/error to extract user-friendly error messages

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
apps/web/**/*.{ts,tsx,css}

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

Follow tailwindcss patterns with prettier-plugin-tailwindcss

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
apps/web/**/*.{ts,tsx,js,jsx,json}

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

Client-side environment variables must be prefixed with NEXT_PUBLIC_

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
**/*.{js,ts,jsx,tsx,py,java,cs,rb,go,php,rs,kt,swift,m}

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

Prefer self-documenting code over comments; use descriptive variable and function names instead of explaining intent with comments. Never add comments that just describe what the code does - code should explain itself. Only add comments for 'why' not 'what'.

Files:

  • apps/web/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
apps/web/utils/actions/!(*.validation).ts

📄 CodeRabbit inference engine (.cursor/rules/fullstack-workflow.mdc)

apps/web/utils/actions/!(*.validation).ts: Use next-safe-action for all server actions with actionClient, .metadata(), .inputSchema(), and .action() chain pattern
Add 'use server' directive at the top of all server action files

Files:

  • apps/web/utils/actions/settings.ts
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]/assistant/settings/FollowUpRemindersSetting.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]/assistant/settings/FollowUpRemindersSetting.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]/assistant/settings/FollowUpRemindersSetting.tsx
apps/web/**/*.{tsx,jsx}

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

apps/web/**/*.{tsx,jsx}: Prefer functional components with hooks
Use shadcn/ui components when available
Follow consistent naming conventions (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 useAction hook from next-safe-action/hooks with onSuccess and onError callbacks for form submission
Use LoadingContent component to handle loading and error states consistently
Call mutate() after successful mutations to refresh SWR data

Files:

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

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

Ensure responsive design with mobile-first approach

Files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
🧠 Learnings (35)
📓 Common learnings
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1234
File: apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx:65-83
Timestamp: 2026-01-09T17:27:31.556Z
Learning: In the elie222/inbox-zero repository, for React components using next-safe-action, optimistic updates combined with mutate on success/error is an accepted pattern for handling potential race conditions in toggle handlers. Select components use disabled={isExecuting}, but rapid toggle clicks without isExecuting guards are considered acceptable because the optimistic UI + mutate reconciliation handles state correctly.
📚 Learning: 2025-11-25T14:39:49.448Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-11-25T14:39:49.448Z
Learning: Applies to apps/web/utils/actions/*.validation.ts : Define input validation schemas using Zod in `.validation.ts` files and export both the schema and its inferred TypeScript type

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:39:49.448Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-11-25T14:39:49.448Z
Learning: Applies to apps/web/utils/actions/*.validation.ts : Create separate validation files for server actions using the naming convention `apps/web/utils/actions/NAME.validation.ts` containing Zod schemas and inferred types

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:39:49.448Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/server-actions.mdc:0-0
Timestamp: 2025-11-25T14:39:49.448Z
Learning: Applies to apps/web/utils/actions/*.ts : Use `.schema()` method with Zod validation schemas from corresponding `.validation.ts` files in next-safe-action configuration

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:39:08.150Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security-audit.mdc:0-0
Timestamp: 2025-11-25T14:39:08.150Z
Learning: Applies to apps/web/app/api/**/*.{ts,tsx} : Request bodies should use Zod schemas for validation to ensure type safety and prevent injection attacks

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2026-01-08T15:09:06.736Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2026-01-08T15:09:06.736Z
Learning: Applies to apps/web/utils/actions/**/*.validation.ts : Create Zod validation schemas at `apps/web/utils/actions/{feature}.validation.ts` for all server action input validation

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:39:27.909Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2025-11-25T14:39:27.909Z
Learning: Applies to **/app/api/**/*.ts : Always validate request bodies using Zod schemas to ensure type safety and prevent invalid data from reaching database operations

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:36:53.147Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:53.147Z
Learning: Applies to **/*.validation.{ts,tsx} : Define validation schemas using Zod

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:36:51.389Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/form-handling.mdc:0-0
Timestamp: 2025-11-25T14:36:51.389Z
Learning: Applies to **/*.validation.ts : Define validation schemas using Zod

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2026-01-09T21:51:15.182Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2026-01-09T21:51:15.182Z
Learning: Applies to apps/web/**/*.{ts,tsx} : Infer types from Zod schemas using `z.infer<typeof schema>` instead of duplicating as separate interfaces

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 Learning: 2025-11-25T14:39:23.326Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/security.mdc:0-0
Timestamp: 2025-11-25T14:39:23.326Z
Learning: Applies to app/api/**/*.ts : All input parameters must be validated - check for presence, type, and format before use; use Zod schemas to validate request bodies with type guards and constraints

Applied to files:

  • apps/web/utils/actions/settings.validation.ts
📚 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/utils/actions/settings.validation.ts
  • apps/web/utils/actions/settings.ts
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
📚 Learning: 2026-01-09T17:27:31.556Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1234
File: apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx:65-83
Timestamp: 2026-01-09T17:27:31.556Z
Learning: In the elie222/inbox-zero repository, for React components using next-safe-action, optimistic updates combined with mutate on success/error is an accepted pattern for handling potential race conditions in toggle handlers. Select components use disabled={isExecuting}, but rapid toggle clicks without isExecuting guards are considered acceptable because the optimistic UI + mutate reconciliation handles state correctly.

Applied to files:

  • apps/web/utils/actions/settings.ts
📚 Learning: 2026-01-09T17:27:19.225Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1234
File: apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx:65-83
Timestamp: 2026-01-09T17:27:19.225Z
Learning: In the elie222/inbox-zero repo, for React components using next-safe-action, using optimistic updates with mutate on success/error is an accepted approach to address race conditions in toggle handlers. It is acceptable for components not to guard rapid toggles with isExecuting (disable) when the optimistic UI state is reconciled by mutate. Apply this guidance to similar TSX components in the web app where appropriate.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-12-31T23:49:09.597Z
Learnt from: rsnodgrass
Repo: elie222/inbox-zero PR: 1154
File: apps/web/app/api/user/setup-progress/route.ts:0-0
Timestamp: 2025-12-31T23:49:09.597Z
Learning: In apps/web/app/api/user/setup-progress/route.ts, Reply Zero enabled status should be determined solely by checking if the TO_REPLY rule is enabled, as it is the critical/canonical rule that Reply Zero is based on. The other conversation status types (FYI, AWAITING_REPLY, ACTIONED) should not be checked for determining Reply Zero setup progress.
<!-- </add_learning>

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.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 **/*.{js,jsx,ts,tsx} : Use isNaN() when checking for NaN

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.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 **/*.{js,jsx,ts,tsx} : Don't use optional chaining where undefined values aren't allowed

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.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 **/*.{js,jsx,ts,tsx} : Use `===` and `!==`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.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
📚 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
📚 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
📚 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
📚 Learning: 2026-01-08T15:09:06.736Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2026-01-08T15:09:06.736Z
Learning: Applies to apps/web/components/**/*.tsx : Use `useAction` hook with `onSuccess` and `onError` callbacks for handling server action responses in forms

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
📚 Learning: 2026-01-07T21:07:06.691Z
Learnt from: elie222
Repo: elie222/inbox-zero PR: 1230
File: apps/web/app/(app)/[emailAccountId]/drive/page.tsx:47-70
Timestamp: 2026-01-07T21:07:06.691Z
Learning: In TSX files across the codebase, prefer direct server action calls with manual error handling (e.g., check result?.serverError and handle errors explicitly). The useAction hook pattern is not required; you can call server actions directly and use try/finally to ensure cleanup (such as resetting loading states) regardless of the hook. Apply consistently for components that perform server interactions.

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/DigestSetting.tsx
  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2026-01-09T21:51:15.182Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2026-01-09T21:51:15.182Z
Learning: Applies to apps/web/**/*.{tsx,jsx} : Use LoadingContent component to handle loading and error states consistently

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2026-01-09T21:51:15.182Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: apps/web/CLAUDE.md:0-0
Timestamp: 2026-01-09T21:51:15.182Z
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]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2026-01-08T15:09:06.736Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/fullstack-workflow.mdc:0-0
Timestamp: 2026-01-08T15:09:06.736Z
Learning: Applies to apps/web/components/**/*.tsx : Use `LoadingContent` component to handle loading and error states, passing `loading`, `error`, and `children` props

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:40:15.063Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:15.063Z
Learning: Applies to **/*.tsx : Use the `LoadingContent` component to handle loading states instead of manual loading state management

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : Use the `LoadingContent` component to handle loading states

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : Implement early returns for invalid LLM inputs, use proper error types and logging, implement fallbacks for AI failures, and add retry logic for transient failures using `withRetry`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : User prompts must contain the actual data and context, and should be kept separate from system prompts

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : LLM feature functions must follow a standard structure: accept options with `inputData` and `emailAccount` parameters, implement input validation with early returns, define separate system and user prompts, create a Zod schema for response validation, and use `createGenerateObject` to execute the LLM call

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:38:07.606Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/llm.mdc:0-0
Timestamp: 2025-11-25T14:38:07.606Z
Learning: Applies to apps/web/utils/ai/**/*.ts : LLM feature functions must import from `zod` for schema validation, use `createScopedLogger` from `@/utils/logger`, `chatCompletionObject` and `createGenerateObject` from `@/utils/llms`, and import `EmailAccountWithAI` type from `@/utils/llms/types`

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
📚 Learning: 2025-11-25T14:40:13.649Z
Learnt from: CR
Repo: elie222/inbox-zero PR: 0
File: .cursor/rules/ui-components.mdc:0-0
Timestamp: 2025-11-25T14:40:13.649Z
Learning: Applies to **/*.{tsx,ts,jsx,js} : For text inputs in forms, use the `Input` component with `type='email'`, `name`, `label`, `registerProps` from react-hook-form, and `error` props

Applied to files:

  • apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx
🧬 Code graph analysis (2)
apps/web/utils/actions/settings.ts (3)
apps/web/utils/actions/safe-action.ts (1)
  • actionClient (84-138)
apps/web/utils/actions/settings.validation.ts (1)
  • toggleDigestBody (55-57)
apps/web/utils/schedule.ts (2)
  • createCanonicalTimeOfDay (12-14)
  • calculateNextScheduleDate (124-227)
apps/web/app/(app)/[emailAccountId]/assistant/settings/FollowUpRemindersSetting.tsx (2)
apps/web/components/ui/dialog.tsx (2)
  • Dialog (116-116)
  • DialogTrigger (120-120)
apps/web/components/Toggle.tsx (1)
  • Toggle (18-50)
⏰ 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: test
🔇 Additional comments (8)
apps/web/utils/actions/settings.validation.ts (1)

54-58: LGTM!

The validation schema follows the established pattern and correctly uses Zod with type inference. As per coding guidelines, validation schemas are properly separated in .validation.ts files.

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

3-20: LGTM!

The imports are appropriate and follow the established patterns. The use of useCallback, useAction, and useEmailAccountFull aligns with the codebase conventions.


24-26: LGTM!

Using != null correctly handles both null and undefined values for the enabled state, matching the approach described in the commit messages.


28-52: LGTM!

The optimistic update pattern with mutate(optimisticData, false) and error recovery using mutate() follows the accepted approach for handling race conditions in toggle handlers. Based on learnings, this pattern is preferred in the codebase.

apps/web/utils/actions/settings.ts (1)

9-18: LGTM!

The imports are appropriate for the new toggle digest functionality, including schedule utilities and enum types.

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

17-17: LGTM!

The Skeleton import is appropriately added to support the loading state UI pattern.


50-50: LGTM!

The useEmailAccountFull hook now correctly exposes isLoading for proper loading state management.


88-121: LGTM!

The conditional rendering with Skeleton during loading and the disabled={!data} prop on the Toggle component follow best practices. This pattern prevents UI flash and ensures the toggle cannot be interacted with before data is available.

@elie222 elie222 merged commit cb278ff into main Jan 11, 2026
27 checks passed
@elie222 elie222 deleted the feat/digest-toggle-ui branch January 11, 2026 20:24
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