Skip to content

[REF-1169] [REF-1168] [REF-1167] feat(schedule): enhance schedule button loading state and error handling#2006

Merged
Siri-Ray merged 1 commit intomainfrom
fix/xirui/schedule-toast
Jan 7, 2026
Merged

[REF-1169] [REF-1168] [REF-1167] feat(schedule): enhance schedule button loading state and error handling#2006
Siri-Ray merged 1 commit intomainfrom
fix/xirui/schedule-toast

Conversation

@Siri-Ray
Copy link
Contributor

@Siri-Ray Siri-Ray commented Jan 7, 2026

  • Added loading state management for the schedule button to improve user experience during enabling/disabling actions.
  • Implemented error handling to display appropriate messages based on dependency checks and save outcomes.
  • Updated the schedule popover content to reflect the loading state visually, preventing user interactions during processing.
  • Added new translation keys for dependency error messages in both English and Chinese.

Files modified:

  • schedule-button.tsx: Introduced loading state and improved error handling logic.
  • schedule-popover-content.tsx: Updated UI to show loading spinner and disable interactions during loading.
  • ui.ts: Added new translation for dependency error messages.

Summary by CodeRabbit

  • New Features

    • Added loading feedback when enabling or disabling schedule operations.
    • Introduced dependency error messaging to notify users when workflows require fixes.
  • UI/UX Improvements

    • Interface controls are disabled during schedule configuration to prevent conflicting interactions.
    • Enhanced support for multiple languages (English and Chinese localization).

✏️ Tip: You can customize this high-level summary in your review settings.

- Added loading state management for the schedule button to improve user experience during enabling/disabling actions.
- Implemented error handling to display appropriate messages based on dependency checks and save outcomes.
- Updated the schedule popover content to reflect the loading state visually, preventing user interactions during processing.
- Added new translation keys for dependency error messages in both English and Chinese.

Files modified:
- schedule-button.tsx: Introduced loading state and improved error handling logic.
- schedule-popover-content.tsx: Updated UI to show loading spinner and disable interactions during loading.
- ui.ts: Added new translation for dependency error messages.
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

The changes add loading state support to the schedule UI components with visual feedback and interaction lockout during operations. Error handling with dependency checks is introduced in the enable logic, with corresponding internationalization entries for dependency error messaging.

Changes

Cohort / File(s) Summary
Schedule UI Components
packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx, packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
Added isEnabledLoading state to track enable/disable operations; wraps dependency checks and subsequent operations in try/catch/finally with warning/success messaging; SchedulePopoverContent now disables all interactive controls (frequency buttons, selects, time picker) during loading and renders Spin component for visual feedback.
Internationalization
packages/i18n/src/en-US/ui.ts, packages/i18n/src/zh-Hans/ui.ts
Added new translation key schedule.dependencyError with localized messages indicating that a scheduled task was saved but the workflow requires fixes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • #1986: Modifies the same schedule UI files (schedule-button.tsx and schedule-popover-content.tsx) with related dependency/checking logic.
  • #1990: Integrates schedule dependency checks and dependency-related state in ScheduleButton enable logic.
  • #1974: Updates the same schedule UI files and i18n entries with loading/refresh behavior changes.

Suggested reviewers

  • mrcfps
  • anthhub

Poem

🐰 Hops through the schedule with loading delight,
Each spinner twirls, each control locked tight,
Dependencies checked with care and grace,
Messages bloom in each locale's place!

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically summarizes the main changes: enhancing the schedule button loading state and error handling across multiple related files.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ 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.

Copy link

@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

🧹 Nitpick comments (2)
packages/i18n/src/zh-Hans/ui.ts (1)

4307-4307: Schedule dependencyError key added correctly and aligned across locales

Key name is consistent with the existing schedule namespace and matches the en-US entry, satisfying the requirement to add new keys in both languages. The Chinese copy is clear and appropriate for a warning after a partial success.

If you want slightly smoother phrasing, you could consider:

Optional copy tweak
-    dependencyError: '定时任务设置成功,但工作流存在问题待修复',
+    dependencyError: '定时任务已保存,但工作流仍存在待修复的问题',

Based on learnings, this keeps localization structure consistent between en-US and zh-Hans.

packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx (1)

273-281: Consider removing redundant loading indicator.

The Ant Design Switch component already displays an internal loading spinner when loading={isEnabledLoading} is set. The additional external <Spin> component may create redundant visual feedback.

♻️ Suggested simplification
-          <div className="flex items-center gap-2">
-            {isEnabledLoading && <Spin size="small" />}
-            <Switch
-              checked={isEnabled}
-              loading={isEnabledLoading}
-              disabled={isEnabledLoading}
-              onChange={onEnabledChange}
-            />
-          </div>
+          <Switch
+            checked={isEnabled}
+            loading={isEnabledLoading}
+            disabled={isEnabledLoading}
+            onChange={onEnabledChange}
+          />
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c2a5831 and 74a46c5.

📒 Files selected for processing (4)
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
🧰 Additional context used
📓 Path-based instructions (22)
**/*.{jsx,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{jsx,tsx}: Always use tailwind css to style the component
Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation
Always use useCallback for function props to maintain referential equality
Always specify proper dependency arrays in useEffect to prevent infinite loops
Always avoid inline object/array creation in render to prevent unnecessary re-renders
Always use proper key props when rendering lists
Always split nested components with closures into separate components to avoid performance issues and improve code maintainability

**/*.{jsx,tsx}: Always wrap pure components with React.memo to prevent unnecessary re-renders
Always use useMemo for expensive computations or complex object creation in React
Always use useCallback for function props to maintain referential equality in React
Always specify proper dependency arrays in useEffect to prevent infinite loops in React
Always avoid inline object/array creation in render to prevent unnecessary re-renders in React
Always use proper key props when rendering lists in React (avoid using index when possible)
Always split nested components with closures into separate components in React
Use lazy loading for components that are not immediately needed in React
Debounce handlers for events that might fire rapidly (resize, scroll, input) in React
Implement fallback UI for components that might fail in React
Use error boundaries to catch and handle runtime errors in React

**/*.{jsx,tsx}: Place each attribute on a new line when a component has multiple attributes in JSX
Use self-closing tags for elements without children in JSX
Keep JSX expressions simple, extract complex logic to variables
Put closing brackets for multi-line JSX on a new line

**/*.{jsx,tsx}: Component file names should match the component name
Organize function components in order: imports, type definitions, constants, component function, hook calls, e...

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
**/*.{js,ts,jsx,tsx}

📄 CodeRabbit inference engine (.cursorrules)

**/*.{js,ts,jsx,tsx}: Always use optional chaining (?.) when accessing object properties
Always use nullish coalescing (??) or default values for potentially undefined values
Always check array existence before using array methods
Always validate object properties before destructuring
Always use single quotes for string literals in JavaScript/TypeScript code

**/*.{js,ts,jsx,tsx}: Use semicolons at the end of statements
Include spaces around operators (e.g., a + b instead of a+b)
Always use curly braces for control statements
Place opening braces on the same line as their statement

**/*.{js,ts,jsx,tsx}: Group import statements in order: React/framework libraries, third-party libraries, internal modules, relative path imports, type imports, style imports
Sort imports alphabetically within each import group
Leave a blank line between import groups
Extract complex logic into custom hooks
Use functional updates for state (e.g., setCount(prev => prev + 1))
Split complex state into multiple state variables rather than single large objects
Use useReducer for complex state logic instead of multiple useState calls

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}

📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)

**/*.{js,ts,tsx,jsx,py,java,cpp,c,cs,rb,go,rs,php,swift,kt,scala,r,m,mm,sql}: All code comments MUST be written in English
All variable names, function names, class names, and other identifiers MUST use English words
Comments should be concise and explain 'why' rather than 'what'
Use proper grammar and punctuation in comments
Keep comments up-to-date when code changes
Document complex logic, edge cases, and important implementation details
Use clear, descriptive names that indicate purpose
Avoid abbreviations unless they are universally understood

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,ts,tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)

Use JSDoc style comments for functions and classes in JavaScript/TypeScript

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)

**/*.{js,jsx,ts,tsx}: Use single quotes for string literals in TypeScript/JavaScript
Always use optional chaining (?.) when accessing object properties in TypeScript/JavaScript
Always use nullish coalescing (??) or default values for potentially undefined values in TypeScript/JavaScript
Always check array existence before using array methods in TypeScript/JavaScript
Validate object properties before destructuring in TypeScript/JavaScript
Use ES6+ features like arrow functions, destructuring, and spread operators in TypeScript/JavaScript
Avoid magic numbers and strings - use named constants in TypeScript/JavaScript
Use async/await instead of raw promises for asynchronous code in TypeScript/JavaScript

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{jsx,tsx,css}

📄 CodeRabbit inference engine (.cursor/rules/01-code-style.mdc)

**/*.{jsx,tsx,css}: Use Tailwind CSS for styling components
Follow the utility-first approach with Tailwind CSS
Group related utility classes together in Tailwind CSS
Prefer Tailwind utilities over custom CSS when possible

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/03-typescript-guidelines.mdc)

**/*.{ts,tsx}: Avoid using any type whenever possible - use unknown type instead with proper type guards
Always define explicit return types for functions, especially for public APIs
Prefer extending existing types over creating entirely new types
Use TypeScript utility types (Partial<T>, Pick<T, K>, Omit<T, K>, Readonly<T>, Record<K, T>) to derive new types
Use union types and intersection types to combine existing types
Always import types explicitly using the import type syntax
Group type imports separately from value imports
Minimize creating local type aliases for imported types

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,ts,jsx,tsx,css,json}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

Maximum line length of 100 characters

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

Use 2 spaces for indentation, no tabs

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{js,ts,jsx,tsx,css,json,yml,yaml,md}

📄 CodeRabbit inference engine (.cursor/rules/04-code-formatting.mdc)

No trailing whitespace at the end of lines

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{jsx,tsx,js}

📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)

Each component file should contain only one main component

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
**/*.tsx

📄 CodeRabbit inference engine (.cursor/rules/05-code-organization.mdc)

Explicitly type props with interfaces or types in React components

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
**/*.{css,scss,sass,less,js,jsx,ts,tsx}

📄 CodeRabbit inference engine (.cursor/rules/09-design-system.mdc)

**/*.{css,scss,sass,less,js,jsx,ts,tsx}: Primary color (#155EEF) should be used for main brand color in buttons, links, and accents
Error color (#F04438) should be used for error states and destructive actions
Success color (#12B76A) should be used for success states and confirmations
Warning color (#F79009) should be used for warnings and important notifications
Info color (#0BA5EC) should be used for informational elements

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{tsx,ts}

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

**/*.{tsx,ts}: Use the translation wrapper component and useTranslation hook in components
Ensure all user-facing text is translatable

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{tsx,ts,json}

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

Support dynamic content with placeholders in translations

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{tsx,ts,jsx,js,vue,css,scss,less}

📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)

**/*.{tsx,ts,jsx,js,vue,css,scss,less}: Use the primary blue (#155EEF) for main UI elements, CTAs, and active states
Use red (#F04438) only for errors, warnings, and destructive actions
Use green (#12B76A) for success states and confirmations
Use orange (#F79009) for warning states and important notifications
Use blue (#0BA5EC) for informational elements
Primary buttons should be solid with the primary color
Secondary buttons should have a border with transparent or light background
Danger buttons should use the error color
Use consistent padding, border radius, and hover states for all buttons
Follow fixed button sizes based on their importance and context
Use consistent border radius (rounded-lg) for all cards
Apply light shadows (shadow-sm) for card elevation
Maintain consistent padding inside cards (p-4 or p-6)
Use subtle borders for card separation
Ensure proper spacing between card elements
Apply consistent styling to all form inputs
Use clear visual indicators for focus, hover, and error states in form elements
Apply proper spacing between elements using 8px, 16px, 24px increments
Ensure proper alignment of elements (left, center, or right)
Use responsive layouts that work across different device sizes
Maintain a minimum contrast ratio of 4.5:1 for text

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{tsx,ts,jsx,js,vue}

📄 CodeRabbit inference engine (.cursor/rules/11-ui-design-patterns.mdc)

**/*.{tsx,ts,jsx,js,vue}: Include appropriate loading states for async actions in buttons
Group related form elements with appropriate spacing
Provide clear validation feedback for forms
Ensure proper labeling and accessibility for form elements
Ensure all interactive elements are keyboard accessible
Include appropriate ARIA attributes for complex components
Provide alternative text for images and icons
Support screen readers with semantic HTML elements

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)

**/*.{ts,tsx,js,jsx}: Follow the TypeScript/JavaScript style guidelines
Ensure code is well-tested and documented

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
**/*.{tsx,jsx}

📄 CodeRabbit inference engine (.cursor/rules/08-contributing-guidelines.mdc)

Use React best practices for frontend code

Files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
**/{i18n,locales,translations,lang}/**/*.{json,ts,tsx,js,jsx,properties}

📄 CodeRabbit inference engine (.cursor/rules/00-language-priority.mdc)

Use Chinese for all user-facing communication

Files:

  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
packages/i18n/src/{en-US,zh-Hans}/**

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

Add new translation keys to both language files (en-US and zh-Hans)

Files:

  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
packages/i18n/src/**

📄 CodeRabbit inference engine (.cursor/rules/09-i18n-guidelines.mdc)

packages/i18n/src/**: Maintain consistency in translation key naming conventions
Use descriptive translation keys that reflect the content
Group related translation keys together in the translation file structure
Use namespaces for different sections of the application in translation keys
Follow a hierarchical structure for nested components in translation key organization

Files:

  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
🧠 Learnings (12)
📓 Common learnings
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/11-ui-design-patterns.mdc:0-0
Timestamp: 2025-11-25T03:05:07.580Z
Learning: Applies to **/*.{tsx,ts,jsx,js,vue} : Include appropriate loading states for async actions in buttons
📚 Learning: 2025-11-25T03:05:07.580Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/11-ui-design-patterns.mdc:0-0
Timestamp: 2025-11-25T03:05:07.580Z
Learning: Applies to **/*.{tsx,ts,jsx,js,vue} : Include appropriate loading states for async actions in buttons

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
  • packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx
📚 Learning: 2025-11-25T03:04:41.334Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/09-i18n-guidelines.mdc:0-0
Timestamp: 2025-11-25T03:04:41.334Z
Learning: Applies to **/*.{tsx,ts} : Use the translation wrapper component and useTranslation hook in components

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:03:31.945Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/01-code-style.mdc:0-0
Timestamp: 2025-11-25T03:03:31.945Z
Learning: Applies to **/*.{jsx,tsx} : Always use useCallback for function props to maintain referential equality in React

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:04:05.715Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/05-code-organization.mdc:0-0
Timestamp: 2025-11-25T03:04:05.715Z
Learning: Applies to **/*.{jsx,tsx} : Use React state hooks for component internal state

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:03:31.945Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/01-code-style.mdc:0-0
Timestamp: 2025-11-25T03:03:31.945Z
Learning: Applies to **/*.{jsx,tsx} : Always use useMemo for expensive computations or complex object creation in React

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:02:45.779Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursorrules:0-0
Timestamp: 2025-11-25T03:02:45.779Z
Learning: Applies to **/*.{jsx,tsx} : Always use useCallback for function props to maintain referential equality

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-26T05:04:26.523Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/08-contributing-guidelines.mdc:0-0
Timestamp: 2025-11-26T05:04:26.523Z
Learning: Applies to **/*.{tsx,jsx} : Use React best practices for frontend code

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:03:31.945Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/01-code-style.mdc:0-0
Timestamp: 2025-11-25T03:03:31.945Z
Learning: Applies to **/*.{jsx,tsx} : Always wrap pure components with React.memo to prevent unnecessary re-renders

Applied to files:

  • packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx
📚 Learning: 2025-11-25T03:04:41.334Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/09-i18n-guidelines.mdc:0-0
Timestamp: 2025-11-25T03:04:41.334Z
Learning: Applies to packages/i18n/src/{en-US,zh-Hans}/** : Add new translation keys to both language files (en-US and zh-Hans)

Applied to files:

  • packages/i18n/src/en-US/ui.ts
  • packages/i18n/src/zh-Hans/ui.ts
📚 Learning: 2025-11-25T03:04:41.334Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/09-i18n-guidelines.mdc:0-0
Timestamp: 2025-11-25T03:04:41.334Z
Learning: Applies to **/*.{tsx,ts} : Ensure all user-facing text is translatable

Applied to files:

  • packages/i18n/src/en-US/ui.ts
📚 Learning: 2025-11-25T03:03:19.158Z
Learnt from: CR
Repo: refly-ai/refly PR: 0
File: .cursor/rules/00-language-priority.mdc:0-0
Timestamp: 2025-11-25T03:03:19.158Z
Learning: Applies to **/{i18n,locales,translations,lang}/**/*.{json,ts,tsx,js,jsx,properties} : Use Chinese for all user-facing communication

Applied to files:

  • packages/i18n/src/zh-Hans/ui.ts
⏰ 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: build / Build
🔇 Additional comments (8)
packages/i18n/src/en-US/ui.ts (1)

4274-4274: New schedule dependencyError translation is clear and well-scoped

The message succinctly describes a “saved but with issues” state and fits naturally beside saveSuccess/createSuccess/updateSuccess. Naming and placement under schedule are consistent with existing keys and the new zh-Hans entry.

packages/ai-workspace-common/src/components/canvas/top-toolbar/schedule-button.tsx (3)

92-92: LGTM! Loading state addition aligns with UI design patterns.

The new isEnabledLoading state appropriately tracks async enable/disable operations. Based on learnings, this follows the guideline to include appropriate loading states for async actions in buttons.


488-522: Well-structured async flow with proper state management.

The try/catch/finally pattern correctly:

  • Sets loading state at the start
  • Performs dependency checks before async operations
  • Resets isEnabled state on error
  • Clears loading state in finally block regardless of outcome

This ensures the UI remains consistent even when operations fail.


675-694: LGTM! Props correctly passed to child component.

The isEnabledLoading prop is properly passed to SchedulePopoverContent, enabling coordinated loading state management between parent and child components.

packages/ai-workspace-common/src/components/common/schedule-popover-content.tsx (4)

31-31: LGTM! Prop interface properly extended.

The optional isEnabledLoading prop with boolean type is correctly added to the interface.


286-304: LGTM! Frequency buttons properly locked during loading.

The buttons are correctly disabled with both the disabled prop and an onClick guard for defense-in-depth. The conditional styling provides appropriate visual feedback.


314-396: LGTM! Consistent interaction lockout across all controls.

All Select and TimePicker components consistently:

  • Apply disabled={isEnabled || isEnabledLoading}
  • Include onChange guards as defensive checks

This ensures users cannot modify settings while an enable/disable operation is in progress.


308-310: LGTM! Visual styling adapts to loading state.

The container border styling correctly reflects the loading/enabled state, providing consistent visual feedback to users.

@Siri-Ray Siri-Ray merged commit 21100b5 into main Jan 7, 2026
2 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.

2 participants