-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(form): number input with comma seperator #53
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Warning Rate limit exceeded@mrbadri has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 14 minutes and 10 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughThis update introduces a new Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant FormSelector
participant NumberField
User->>App: Loads Application
App->>FormSelector: Initialize form
FormSelector->>NumberField: Lazy load number field
NumberField-->>FormSelector: Ready
FormSelector-->>App: Render number field
App-->>User: Displays number input
Assessment against linked issues
Poem
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
There was a problem hiding this 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
Outside diff range and nitpick comments (4)
packages/core/src/modules/form/src/components/fields/number/number.loading.tsx (1)
1-3
: Ensure consistent import ordering.Consider ordering the imports by external libraries first, followed by internal modules for better readability and maintainability.
packages/core/src/modules/form/src/components/fields/number/number.tsx (1)
1-7
: Ensure consistent import ordering.Consider ordering the imports by external libraries first, followed by internal modules for better readability and maintainability.
packages/core/src/modules/form/src/types/public.types.ts (1)
Line range hint
11-31
: Typographical error in type name.The type name
Dependesies
should be corrected toDependencies
.- export type Dependesies = string[]; + export type Dependencies = string[];packages/core/src/modules/form/src/components/fields/number/useNumber.ts (1)
1-2
: Consider Grouping Related ImportsThe imports from
react-hook-form
are correct. Consider grouping related imports together to improve readability.- import { useController, useWatch } from 'react-hook-form'; + import { useController, useWatch } from 'react-hook-form'; + import useQueryBuilder from '@mui-builder/utils/useQueryBuilder/useQueryBuilder'; + import UseScript from '@mui-builder/utils/useScript/useScript';
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (9)
- .vscode/settings.json (1 hunks)
- apps/docs/src/app/app.tsx (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/number.loading.tsx (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/number.tsx (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/number.types.ts (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/useNumber.loading.ts (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/useNumber.ts (1 hunks)
- packages/core/src/modules/form/src/types/public.types.ts (2 hunks)
- packages/core/src/modules/form/src/utils/selector/formSelector.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
- .vscode/settings.json
Additional context used
Biome
packages/core/src/modules/form/src/components/fields/number/useNumber.ts
[error] 53-53: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.(lint/suspicious/noGlobalIsNan)
Additional comments not posted (7)
packages/core/src/modules/form/src/components/fields/number/number.loading.tsx (2)
7-11
: LGTM!The
NumberFieldLoading
component correctly uses theSkeleton
component from Material-UI and the custom hookuseNumberFieldLoading
to get the props.
5-5
: Avoid potential circular dependency.Ensure that
useNumberFieldLoading
does not create a circular dependency withNumberFieldLoading
.Verification successful
No circular dependency detected.
The
useNumberFieldLoading
does not create a circular dependency withNumberFieldLoading
.
useNumberFieldLoading
is defined inuseNumber.loading.ts
and does not referencenumber.loading.tsx
.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify if there is a circular dependency involving `useNumberFieldLoading`. # Test: Check for circular dependencies. Expect: No circular dependencies. rg --type js --type ts 'useNumberFieldLoading' | grep 'number.loading.tsx'Length of output: 358
Script:
#!/bin/bash # Description: Check if `useNumberFieldLoading` creates a circular dependency by importing or referencing `number.loading.tsx`. # Locate the file that defines `useNumberFieldLoading` file_path=$(fd useNumber.loading.tsx) # Search for imports or references to `number.loading.tsx` within the located file rg 'number.loading.tsx' $file_pathLength of output: 64
Script:
#!/bin/bash # Description: Check if `useNumberFieldLoading` creates a circular dependency by importing or referencing `number.loading.tsx`. # Locate all files that match `useNumber.loading.tsx` fd useNumber.loading.tsx # Search for imports or references to `number.loading.tsx` within the located files fd useNumber.loading.tsx --exec rg 'number.loading.tsx' {}Length of output: 87
Script:
#!/bin/bash # Description: Locate the definition of `useNumberFieldLoading` and check for references to `number.loading.tsx`. # Locate the definition of `useNumberFieldLoading` ast-grep --lang ts --pattern 'function useNumberFieldLoading($_) { $$$ }' # Check for references to `number.loading.tsx` within the located file(s) fd useNumber.loading.tsx --exec rg 'number.loading.tsx' {}Length of output: 136
Script:
#!/bin/bash # Description: Locate all instances of `useNumberFieldLoading` definition and check for references to `number.loading.tsx`. # Locate all instances of `useNumberFieldLoading` definition ast-grep --lang ts --pattern 'const useNumberFieldLoading = $_' ast-grep --lang ts --pattern 'function useNumberFieldLoading($_) { $$$ }' # Check for references to `number.loading.tsx` within the located files fd useNumber.loading.tsx --exec rg 'number.loading.tsx' {}Length of output: 2137
packages/core/src/modules/form/src/components/fields/number/number.tsx (1)
9-15
: LGTM!The
NumberField
component correctly uses theTextField
component from Material-UI and the custom hookuseNumberField
to get the props and visibility state.packages/core/src/modules/form/src/components/fields/number/useNumber.loading.ts (1)
1-22
: LGTM!The
useNumberFieldLoading
hook correctly extracts and returns the props for theSkeleton
component.packages/core/src/modules/form/src/utils/selector/formSelector.tsx (2)
14-15
: Ensure Consistency in Import StatementsThe import statements for
NumberFieldProps
andNumberFieldLoading
are correctly added. Make sure the paths are accurate and consistent with the rest of the project.
72-81
: New Field Type Integration Looks GoodThe integration of the new 'number' field type in the
FormSelector
component looks good. The lazy loading and fallback toNumberFieldLoading
are implemented correctly.apps/docs/src/app/app.tsx (1)
222-231
: New Number Field Type Added CorrectlyThe new number field type is added correctly to the
children
array in theApp
component. Ensure that theid
andformId
values are unique and accurate.
packages/core/src/modules/form/src/components/fields/number/useNumber.ts
Show resolved
Hide resolved
packages/core/src/modules/form/src/components/fields/number/number.types.ts
Outdated
Show resolved
Hide resolved
…-feat-input-number
There was a problem hiding this 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
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (3)
- apps/docs/src/app/app.tsx (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/number.types.ts (1 hunks)
- packages/core/src/modules/form/src/components/fields/number/useNumber.ts (1 hunks)
Files skipped from review as they are similar to previous changes (2)
- apps/docs/src/app/app.tsx
- packages/core/src/modules/form/src/components/fields/number/number.types.ts
Additional context used
Biome
packages/core/src/modules/form/src/components/fields/number/useNumber.ts
[error] 60-60: isNaN is unsafe. It attempts a type coercion. Use Number.isNaN instead.
See the MDN documentation for more details.
Unsafe fix: Use Number.isNaN instead.(lint/suspicious/noGlobalIsNan)
Additional comments not posted (8)
packages/core/src/modules/form/src/components/fields/number/useNumber.ts (8)
1-12
: LGTM! Imports are relevant and necessary.The imports are appropriate for the functionality provided in this file.
27-32
: LGTM! API and form hooks are used appropriately.The hooks are correctly used to manage the API and form state.
33-34
: LGTM! Props controller usage is appropriate.The usage of
usePropsController
and the assignment ofnewProps
are correct.
35-42
: LGTM! Script handling is appropriate.The script handling using the
UseScript
hook is correct.
44-47
: LGTM! Number formatting function is correct.The
formatNumber
function correctly formats the number with thousands separators.
65-69
: LGTM! useWatch hook is used correctly.The
useWatch
hook is correctly used to watch dependencies.
71-79
: LGTM! API call handling is correct.The
useQueryBuilder
hook is correctly used to handle API calls.
81-111
: LGTM! Controller usage and return statement are correct.The
useController
hook is correctly used to manage the field state. The return statement correctly returns the field props.
Closes #52
📝 Description
⛳️ Current behavior (updates)
🚀 New behavior
💣 Is this a breaking change (Yes/No):
📝 Additional Information
Summary by CodeRabbit
New Features
NumberField
component for form inputs, allowing users to interact with number fields.Enhancements
NumberField
component.Developer Experience
CodeGPT
API key to streamline development setup.