Skip to content

Conversation

@kotAPI
Copy link
Collaborator

@kotAPI kotAPI commented Aug 2, 2025

Summary by CodeRabbit

  • Chores

    • Updated the pre-commit process to run tests before linting, ensuring code quality checks are performed prior to each commit.
    • Added staged file linting with ESLint and Stylelint to improve code consistency on changed files.
  • Documentation

    • Fixed the display of the "Text" API documentation table, making it visible to users.
  • Bug Fixes

    • Corrected warning message in the collapsible component for clearer user guidance.
  • New Features

    • Enhanced the visually hidden component with improved accessibility styles, flexible styling options, and richer usage examples.
    • Introduced a new hook to track document visibility state, enabling responsive UI behavior based on page visibility.
    • Added indeterminate state support and improved accessibility to the progress component with new state indicators and labels.
  • Chores

    • Removed obsolete CSS for visually hidden elements and cleaned up related theme imports.
  • Tests

    • Expanded test coverage for the visually hidden component, verifying styling, accessibility, prop forwarding, and rendering variations.
    • Added comprehensive tests for the new document visibility hook to ensure accurate state tracking and event handling.
    • Extended progress component tests to cover new states, data attributes, and state transitions for robust validation.

@kotAPI kotAPI linked an issue Aug 2, 2025 that may be closed by this pull request
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 2, 2025

Walkthrough

The changes update the pre-commit hook script to run tests and set up the shell environment before linting staged files, add a new lint-staged configuration and dependencies, fix a documentation comment to show the "Text" API table, correct a warning message in the Collapsible component, and refactor the VisuallyHidden component to use default inline styles instead of a CSS class, removing the related stylesheet and import. Additionally, the VisuallyHidden component's stories and tests were expanded significantly to demonstrate usage and improve coverage. A new React hook useIsDocumentHidden was introduced with corresponding tests. Progress component enhancements include support for indeterminate state, accessibility improvements, and expanded tests and stories.

Changes

Cohort / File(s) Change Summary
Pre-commit Hook and Linting Setup
.husky/pre-commit, package.json
Added shell environment sourcing and changed pre-commit to run npm test then npm run lint:staged; added lint:staged script, config, and dependency.
Documentation Fix
docs/app/docs/components/callout/page.mdx
Removed trailing comment marker to make the "Text" API documentation table visible.
UI Component Warning Correction
src/components/ui/Collapsible/Collapsible.tsx
Fixed warning message to correctly reference the Collapsible component and its subcomponents instead of Tabs.
VisuallyHidden Component Refactor
src/components/ui/VisuallyHidden/VisuallyHidden.tsx, styles/themes/components/visuallyhidden.scss, styles/themes/default.scss
Replaced .rad-ui-visually-hidden CSS class with inline default visually hidden styles; extended component props to accept style and HTML div attributes; removed related SCSS file and import.
VisuallyHidden Stories Expansion
src/components/ui/VisuallyHidden/stories/VisuallyHidden.stories.tsx
Replaced minimal stories with multiple detailed examples demonstrating accessibility, usage with icons, asChild prop, and custom styling.
VisuallyHidden Tests Expansion
src/components/ui/VisuallyHidden/tests/VisuallyHidden.test.js
Replaced minimal tests with comprehensive coverage of rendering, styling, accessibility, prop forwarding, and asChild behavior.
New Hook for Document Visibility
src/core/hooks/useIsDocumentHidden/index.ts, src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx
Added useIsDocumentHidden hook to track document visibility state with event listener; added tests covering initialization, event handling, and state updates.
Progress Component Enhancements
src/components/ui/Progress/contexts/ProgressContext.tsx, src/components/ui/Progress/fragments/ProgressRoot.tsx, src/components/ui/Progress/fragments/ProgressIndicator.tsx, src/components/ui/Progress/stories/Progress.stories.tsx, src/components/ui/Progress/tests/Progress.test.tsx
Updated ProgressContext to allow null value and added state and ariaLabel; enhanced ProgressRoot with indeterminate state, accessibility labels, and state tracking; ProgressIndicator updated with state data attributes; added story buttons for indeterminate and complete states; expanded tests for data attributes and state transitions.
Dependency Version Update
docs/package.json
Updated @radui/ui dependency version from ^0.0.44 to ^0.0.45.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Possibly related PRs

Suggested labels

automerge

Suggested reviewers

  • GoldGroove06

Poem

A bunny hops with nimble feet,
Pre-commit now tests complete!
Docs reveal a hidden text,
No more comments to perplex.
Visually hidden styles now shine,
Stories, tests, and code align. 🐇✨

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e01e915 and 074f1c9.

📒 Files selected for processing (2)
  • src/core/hooks/useIsDocumentHidden/index.ts (1 hunks)
  • src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • src/core/hooks/useIsDocumentHidden/index.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx
⏰ 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
✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch kotapi/aug-2-2025-improvements

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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: 5

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5d4bf11 and 7ce41ac.

📒 Files selected for processing (2)
  • .husky/pre-commit (1 hunks)
  • docs/app/docs/components/callout/page.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📚 Learning: the code object in docs/app/docsv2/components/aspect-ratio/docs/codeusage.js requires two closing br...
Learnt from: GoldGroove06
PR: rad-ui/ui#889
File: docs/app/docsv2/components/aspect-ratio/docs/codeUsage.js:16-17
Timestamp: 2025-02-22T18:53:12.639Z
Learning: The code object in docs/app/docsv2/components/aspect-ratio/docs/codeUsage.js requires two closing braces - one for the inner `javascript` object and another for the outer `code` object.

Applied to files:

  • docs/app/docs/components/callout/page.mdx
📚 Learning: in npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their co...
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.

Applied to files:

  • .husky/pre-commit
🔇 Additional comments (2)
docs/app/docs/components/callout/page.mdx (1)

50-50: LGTM! Text API documentation table is now visible.

The uncommenting of the Text API documentation table correctly exposes this component's API documentation to users.

.husky/pre-commit (1)

6-6: Excellent addition of testing to pre-commit workflow.

Adding npm test to the pre-commit hook ensures code quality by running tests before each commit, which aligns well with the PR objectives of improvements and fixes.

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

🧹 Nitpick comments (2)
package.json (2)

70-72: Script overlap ‒ risk of divergent lint behaviour between lint and lint:staged

The new lint:staged script is great for pre-commit, but the existing lint script still lints all files with hard-coded flags. Over time these two command lines can drift (different flags, plugins, caching, etc.).

Consider refactoring to keep one single source of truth, e.g.:

- "lint": "eslint --ext .js,.jsx,.ts,.tsx . --fix && stylelint \"**/*.{css,scss,sass}\" --fix",
+ "lint": "npm run lint:staged -- --no-stash",

or move the common logic into an npm run lint:base that both scripts call.
This reduces duplication and ensures both CI and pre-commit use identical rules.


76-83: Speed up staged linting with ESLint cache

eslint --fix re-analyses unchanged files each commit. Adding --cache cuts the run time dramatically while keeping correctness.

-    "*.{js,jsx,ts,tsx}": [
-      "eslint --fix"
-    ],
+    "*.{js,jsx,ts,tsx}": [
+      "eslint --cache --fix"
+    ],

(No equivalent cache flag exists for Stylelint yet.)

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ce41ac and af18f6d.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (6)
  • .husky/pre-commit (1 hunks)
  • package.json (3 hunks)
  • src/components/ui/Collapsible/Collapsible.tsx (1 hunks)
  • src/components/ui/VisuallyHidden/VisuallyHidden.tsx (1 hunks)
  • styles/themes/components/visuallyhidden.scss (0 hunks)
  • styles/themes/default.scss (0 hunks)
💤 Files with no reviewable changes (2)
  • styles/themes/components/visuallyhidden.scss
  • styles/themes/default.scss
✅ Files skipped from review due to trivial changes (1)
  • src/components/ui/Collapsible/Collapsible.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • .husky/pre-commit
🧰 Additional context used
🧠 Learnings (5)
📓 Common learnings
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.
📚 Learning: in npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their co...
Learnt from: GoldGroove06
PR: rad-ui/ui#1214
File: package.json:64-64
Timestamp: 2025-07-14T18:13:36.606Z
Learning: In npm, lifecycle scripts with `pre` and `post` prefixes automatically run before and after their corresponding main scripts. For example, a `prebuild` script will automatically run before the `build` script when executing `npm run build`, so there's no need to explicitly call `npm run prebuild` in the build script.

Applied to files:

  • package.json
📚 Learning: in the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and...
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.

Applied to files:

  • package.json
📚 Learning: ensure to verify existing aria attributes in components before suggesting additions during code revi...
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.

Applied to files:

  • src/components/ui/VisuallyHidden/VisuallyHidden.tsx
📚 Learning: in the `toggleprimitive` component (`src/core/primitives/toggle/index.tsx`), when the component beco...
Learnt from: kotAPI
PR: rad-ui/ui#576
File: src/core/primitives/Toggle/index.tsx:15-22
Timestamp: 2024-11-24T06:43:42.194Z
Learning: In the `TogglePrimitive` component (`src/core/primitives/Toggle/index.tsx`), when the component becomes controlled, it's acceptable to not sync the internal `isPressed` state with the external `pressed` prop.

Applied to files:

  • src/components/ui/VisuallyHidden/VisuallyHidden.tsx
⏰ 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
🔇 Additional comments (4)
package.json (1)

134-134: Dependency addition LGTM

Adding lint-staged@16.1.2 is a standard, non-breaking dev-only dependency and aligns with the new script/config.

src/components/ui/VisuallyHidden/VisuallyHidden.tsx (3)

2-2: LGTM!

The addition of CSSProperties import is correct and necessary for typing the inline styles.


14-15: Enhanced props typing improves flexibility.

The addition of the optional style prop and extension with React.HTMLAttributes<HTMLDivElement> provides better flexibility and type safety while maintaining backward compatibility.


33-50: Well-implemented style merging approach.

The component correctly merges default visually hidden styles with user-provided styles, allowing for customization while maintaining the core accessibility functionality. The refactored JSX structure improves readability.

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: 2

🧹 Nitpick comments (1)
src/core/hooks/useIsDocumentHidden/index.ts (1)

11-11: Consider SSR safety for document access.

Direct access to document.hidden during initialization could cause issues in server-side rendering environments where document is undefined.

-    const [isDocumentHidden, setIsDocumentHidden] = React.useState(document.hidden);
+    const [isDocumentHidden, setIsDocumentHidden] = React.useState(
+        typeof document !== 'undefined' ? document.hidden : false
+    );
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 20ea936 and 7d7c841.

📒 Files selected for processing (2)
  • src/core/hooks/useIsDocumentHidden/index.ts (1 hunks)
  • src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
Learnt from: GoldGroove06
PR: rad-ui/ui#1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.175Z
Learning: In the CheckboxGroupPrimitiveTrigger component (`src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx`), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array `[]` is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local `isChecked` changes back to the group's `checkedValues`. This pattern prevents infinite loops while maintaining proper synchronization.
📚 Learning: in the checkboxgroupprimitivetrigger component (`src/core/primitives/checkboxgroup/fragments/checkbo...
Learnt from: GoldGroove06
PR: rad-ui/ui#1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.175Z
Learning: In the CheckboxGroupPrimitiveTrigger component (`src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx`), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array `[]` is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local `isChecked` changes back to the group's `checkedValues`. This pattern prevents infinite loops while maintaining proper synchronization.

Applied to files:

  • src/core/hooks/useIsDocumentHidden/index.ts
  • src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx
🧬 Code Graph Analysis (1)
src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx (1)
src/core/hooks/useIsDocumentHidden/index.ts (1)
  • useIsDocumentHidden (10-22)
⏰ 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
🔇 Additional comments (6)
src/core/hooks/useIsDocumentHidden/index.ts (1)

3-8: Good documentation with proper attribution.

The JSDoc comment provides clear documentation and properly attributes the original source.

src/core/hooks/useIsDocumentHidden/useIsDocumentHidden.test.tsx (5)

23-36: Excellent test setup with callback capture mechanism.

The beforeEach setup with callback capture is well-designed and allows for proper simulation of visibility change events.


43-59: Good coverage of initial state scenarios.

The tests properly verify that the hook initializes with the correct state based on the current document.hidden value in both visible and hidden states.


70-102: Thorough testing of state updates on visibility changes.

The tests properly use act() to wrap state updates and verify that the hook responds correctly to visibility changes in both directions.


149-172: Great test for multiple hook instances.

This test ensures that multiple instances of the hook work independently while all responding to the same global visibility changes, which is important for the hook's reusability.


174-197: Excellent edge case testing with rapid changes.

Testing rapid visibility changes within a single act() block ensures the hook handles high-frequency state updates correctly.

@kotAPI kotAPI linked an issue Aug 2, 2025 that may be closed by this pull request
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

🧹 Nitpick comments (1)
src/components/ui/Progress/stories/Progress.stories.tsx (1)

49-61: Consider improving type assertion for null value.

The new buttons effectively demonstrate state transitions. However, the null as any type assertion on Line 52 bypasses TypeScript checking. Consider updating the component types to properly support null values or use a more specific type assertion.

Consider replacing:

-setValue(null as any);
+setValue(null);

If this causes TypeScript errors, the component's type definitions should be updated to properly support nullable values.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f2126e3 and e01e915.

📒 Files selected for processing (3)
  • src/components/ui/Progress/fragments/ProgressIndicator.tsx (1 hunks)
  • src/components/ui/Progress/stories/Progress.stories.tsx (3 hunks)
  • src/components/ui/Progress/tests/Progress.test.tsx (2 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/ui/Progress/fragments/ProgressIndicator.tsx
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.
Learnt from: kotAPI
PR: rad-ui/ui#640
File: .github/workflows/build-rad-ui.yml:5-5
Timestamp: 2024-12-14T02:25:41.034Z
Learning: In the `rad-ui/ui` repository, the `security-fixes` branch only updates dependencies, so linting and Chromatic workflows are not required for this branch.
Learnt from: GoldGroove06
PR: rad-ui/ui#1215
File: src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx:25-27
Timestamp: 2025-07-18T16:43:26.175Z
Learning: In the CheckboxGroupPrimitiveTrigger component (`src/core/primitives/CheckboxGroup/fragments/CheckboxGroupPrimitiveTrigger.tsx`), the component uses two separate useEffect hooks with different purposes: the first useEffect (lines 25-27) with empty dependency array `[]` is meant to set the initial state only once on mount by syncing with the group's checked values, while the second useEffect (lines 28-34) handles ongoing state updates by propagating local `isChecked` changes back to the group's `checkedValues`. This pattern prevents infinite loops while maintaining proper synchronization.
📚 Learning: ensure to verify existing aria attributes in components before suggesting additions during code revi...
Learnt from: decipher-cs
PR: rad-ui/ui#417
File: src/components/ui/Dropdown/Dropdown.stories.tsx:43-50
Timestamp: 2024-12-12T08:34:33.079Z
Learning: Ensure to verify existing ARIA attributes in components before suggesting additions during code reviews, especially in the `Dropdown.Trigger` component in `src/components/ui/Dropdown/Dropdown.stories.tsx`.

Applied to files:

  • src/components/ui/Progress/tests/Progress.test.tsx
  • src/components/ui/Progress/stories/Progress.stories.tsx
📚 Learning: the accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props l...
Learnt from: kotAPI
PR: rad-ui/ui#1031
File: src/components/ui/Accordion/fragments/AccordionRoot.tsx:41-44
Timestamp: 2025-04-07T04:38:34.864Z
Learning: The Accordion component in rad-ui/ui supports both controlled and uncontrolled modes through props like `value`, `defaultValue`, and `onValueChange`. When implementing controlled components, remember to: 1) Initialize state from defaultValue, 2) Update internal state when value changes (controlled mode), 3) Call onValueChange callback, and 4) Prevent internal state updates when in controlled mode.

Applied to files:

  • src/components/ui/Progress/stories/Progress.stories.tsx
🧬 Code Graph Analysis (1)
src/components/ui/Progress/stories/Progress.stories.tsx (1)
src/core/primitives/Primitive/Primitive.stories.tsx (1)
  • Button (20-25)
⏰ 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
🔇 Additional comments (7)
src/components/ui/Progress/tests/Progress.test.tsx (4)

6-6: LGTM: Type update supports indeterminate state.

The type change from number to number | null correctly reflects the component's new support for indeterminate progress state.


17-45: Good architectural pattern: Multiple progressbar elements.

The switch to getAllByRole('progressbar') correctly handles the component's structure with separate root and indicator elements. The comment on Line 24 about root vs indicator clamping behavior is particularly helpful for understanding the component's design.


47-275: Excellent comprehensive test coverage.

The new test suites provide thorough validation of:

  • Data attributes for both root and indicator elements
  • All progress states (loading, complete, indeterminate)
  • Custom label functionality with getValueLabel
  • Dynamic state transitions
  • Boundary conditions and edge cases

The test organization with nested describe blocks makes the suite easy to navigate and maintain.


133-133: No changes needed: null values deliberately default to 0 for getValueLabel
The ProgressRoot implementation calls getValueLabel with (value ?? 0), so passing 0 when value is null is intentional and aligns with the component’s API (its signature only accepts number). The test’s expectation is correct—no code changes required.

src/components/ui/Progress/stories/Progress.stories.tsx (3)

10-35: Excellent comprehensive documentation.

The detailed documentation clearly explains the Progress component's features including data attributes, state management, and accessibility support. This will be very helpful for developers using the component.


80-133: Excellent interactive demonstration of data attributes.

This story provides valuable hands-on experience with the component's data attributes. The real-time updates and explanatory text make it easy to understand how the attributes work.


135-333: Comprehensive story coverage of advanced features.

The three additional stories provide excellent coverage:

  • StateTransitions: Great animated demonstration with proper cleanup
  • CustomLabels: Shows flexibility of getValueLabel with multiple practical examples
  • CustomRanges: Demonstrates non-standard value ranges effectively

The implementation quality is high with proper state management and educational value.

@kotAPI kotAPI merged commit 5b3a057 into main Aug 2, 2025
7 checks passed
@kotAPI kotAPI deleted the kotapi/aug-2-2025-improvements branch August 2, 2025 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants