-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fixed reset rating field to "no value" on star re-click #6296
Conversation
Log
|
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.
PR Summary
- Modified
packages/twenty-front/src/modules/object-record/record-field/meta-types/hooks/useRatingField.ts
to set default rating value tonull
. - Updated
packages/twenty-front/src/modules/object-record/record-field/types/FieldMetadata.ts
to includenull
inFieldRatingValue
type. - Adjusted
packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx
to reset rating field to 'No Value' on star re-click, usinguseClearField
hook.
3 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
} | ||
}; | ||
|
||
useEffect(() => { |
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.
Can you try getting rid of the effect? https://react.dev/learn/you-might-not-need-an-effect
Looks good otherwise, thanks!
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.
Sure I'll check this
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.
@FelixMalfait I have removed useEffect
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.
PR Summary
(updates since last review)
- Updated
packages/twenty-front/src/modules/ui/field/input/components/RatingInput.tsx
to reset rating to 'no value' on star re-click. - Changed default rating value from 1 star to no star.
- Enhanced
handleClick
logic to clear the field when the same star is clicked again.
1 file(s) reviewed, no comment(s)
Edit PR Review Bot Settings
6886862
to
6deed57
Compare
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.
Thank you for your contribution @Ashmash100 ! 🔥
I just removed the useRef and fixed filtering as well.
Description
Resolves Issue: https://github.com/twentyhq/twenty/issues/6224
Additional Consideration
I have changed the default start rating value from 1 star to no star since clicking on the selected start was reverting the filed to 1 star which didn't seem like the appropriate behaviour. Let me know if this change is fine