-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
fix:ensure save row button is disabled when date column is required #34711
Conversation
WalkthroughThe updates to the Changes
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 Configuration File (
|
This PR has not seen activitiy for a while. It will be closed in 7 days unless further activity is detected. |
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: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx (6 hunks)
- app/client/src/widgets/TableWidgetV2/widget/derived.js (4 hunks)
Additional comments not posted (5)
app/client/src/widgets/TableWidgetV2/component/cellComponents/DateCell.tsx (3)
1-1
: LGTM!The inclusion of
useEffect
hook is necessary for the newly added hook.
199-205
: LGTM!The
useEffect
hook correctly handles the validation based onisRequired
andvalue
.
Line range hint
224-239
:
LGTM!The changes ensure correct date formatting and validation in
onDateSelected
and correct state update inonPopoverClosed
.Also applies to: 253-255
app/client/src/widgets/TableWidgetV2/widget/derived.js (2)
788-788
: LGTM!Including the
date
type invalidatableColumns
ensures that date columns are validated.
Line range hint
840-846
:
LGTM!The additional validations correctly handle
min
andmax
constraints fordate
type columns.
Added a comment on the issue to review it. |
…smith into bug-date-column-set-as-required-does-not-making-it-mandatory-for-adding-new-table-row-34258
@saiprabhu-dandanayak The assets in PR description are not loading for me. Can you please re-upload the images and video? |
Hi @rahulbarwal , i have attached the same |
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.
Functionally seems fine. Can you please also add some tests for these change?
@@ -241,8 +250,9 @@ export const DateCell = (props: DateComponentProps) => { | |||
}; | |||
|
|||
const onPopoverClosed = () => { | |||
const isValidValue = value !== undefined && value !== null; |
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.
const isValidValue = value !== undefined && value !== null; | |
const isValidValue = !!value; |
Also Don't we have to consider isRequired
here?
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.
we have to considering isRequired
also
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.
Also, Due to this check we are unable to put any value if the col already did not have a value.
Steps:
- drop table
- Add data source with date col and it not having some data in some cols.
- Make editable, type:date and set required.
- Now, edit the col which does not have a value.
Expected: should be able to add new date value.
Actual, nothing happens; datepicker does not close.
Video:
https://github.com/user-attachments/assets/45309303-ca35-4db6-9a2e-f54d1c392875
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.
Hi @rahulbarwal , will look into this and update the pr with expected results.
|
@saiprabhu-dandanayak any updates here? |
Working on testcases @rahulbarwal |
@saiprabhu-dandanayak |
Hi @rahulbarwal , it is working fine for new row , but not for existing one , i am working on it. |
@saiprabhu-dandanayak Is there anyway I can help with this? Are there any specific areas in the code you are struggling with? |
Hi @jacquesikot , when we add |
@saiprabhu-dandanayak I will look into this today. Thanks |
Hello @saiprabhu-dandanayak I don't understand why we need to make changes in the derived.js file. I have made one change in the DateCell.tsx component, and it seems to solve all the problems reported without breaking the existing logic for existing cell values. I added
No other change was required, check this branch when you get the chance - fix/disable-new-row-when-required-table-date-validation Let me know if this solves your problems. If it does, you can go ahead with tests and prop the final PR for review. Thanks again for the effort. |
Hi @jacquesikot , i have added |
@saiprabhu-dandanayak Can you check my branch and see if my change solves the issues? I don't think you need to add date in validateCells in derived.js file |
Hi @jacquesikot , thanks for your support and will checkout to your branch and check functionality and move ahead with testcases , can you pls confirm check #29662 this issue , i am not able to reproduce. if it is already fixed pls close the issue. |
@saiprabhu-dandanayak To the best of my knowledge, the issues has not been fixed. I will try to reproduce on my end and send a loom video if i can. |
@saiprabhu-dandanayak I am also not able to reproduce, I will check the status of this and update you. Thanks |
Ok @jacquesikot |
Hey @saiprabhu-dandanayak any update? need any more help? |
Hi @jacquesikot , I haven't actually checked it , will check and let you know. Thank you. |
…smith into bug-date-column-set-as-required-does-not-making-it-mandatory-for-adding-new-table-row-34258
Hi @jacquesikot , after incorporating your chnages the issue still not yet resolved , below is the screenshot for your reference. Screenshot |
@saiprabhu-dandanayak Did you check my branch to be sure it works appropriately there? The change I recommended is a standalone change, it should not be included with any other changes |
@saiprabhu-dandanayak Please review my branch again, I misunderstood your requirements, I have made some changes to the derived.js file within that branch, check if this solves your problems completely. |
Ok @jacquesikot , will check and let you know |
@saiprabhu-dandanayak Due to our priorities, I will be picking this issue up, I will update the PR i sent with tests and you can review when you get the chance |
…smith into bug-date-column-set-as-required-does-not-making-it-mandatory-for-adding-new-table-row-34258
@saiprabhu-dandanayak Thanks for helping with this, here is the merged PR that fixed the issue - #35613 |
Description
Bug : Table date column bug
I have raised this PR
In-order to ensure that the save row button is disabled when the date column is set to required
📸 Screenshot
when department and doj are set to required save row is disabled
when department has value and doj doesn't have , still the save row button is enabled
when department and doj are set to required save row button is disabled and doj column indicating error
when department has value and doj doesn't have , still the save row button is disabled
when both the fieilds have values save row button is enabled
📸 Cypress Testing Video
AddNewRow_Date_Column_Validation_Spec.js.mp4
Caution
If you modify the content in this section, you are likely to disrupt the CI result for your PR.
Communication
Should the DevRel and Marketing teams inform users about this change?
Summary by CodeRabbit
New Features
Bug Fixes
Improvements