Skip to content
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: UI mismatch with form state #10651

Merged
merged 11 commits into from
Jan 24, 2024
Merged

fix: UI mismatch with form state #10651

merged 11 commits into from
Jan 24, 2024

Conversation

MehulZR
Copy link
Contributor

@MehulZR MehulZR commented Aug 8, 2023

What does this PR do?

Fixes #10647 (issue)
Fixes #10390 (issue)

video.mp4

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Mandatory Tasks

  • Make sure you have self-reviewed the code. A decent size PR without self-review might be rejected.

@vercel
Copy link

vercel bot commented Aug 8, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
ui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jan 23, 2024 3:48pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
calcom-web-canary ⬜️ Ignored (Inspect) Jan 23, 2024 3:48pm

@vercel
Copy link

vercel bot commented Aug 8, 2023

@MehulZR is attempting to deploy a commit to the cal Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

Thank you for following the naming conventions! 🙏 Feel free to join our discord and post your PR link.

@github-actions github-actions bot added Low priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work 🐛 bug Something isn't working 🧹 Improvements Improvements to existing features. Mostly UX/UI labels Aug 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 8, 2023

📦 Next.js Bundle Analysis for @calcom/web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

This PR introduced no changes to the JavaScript bundle! 🙌

@hariombalhara
Copy link
Member

@MehulZR Could you please remove the changes related to #10390 from this PR as that's already solved(and being solved) elsewhere already.

Also, you should open separate PRs for separate fixes unless they are really really related. It makes it easy to review and merge the PR

Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MehulZR please remove conflicts and changes related to #10390

@MehulZR
Copy link
Contributor Author

MehulZR commented Aug 14, 2023

While updating the PR, I noticed that it is possible to book a event with length of 0. This is possible when saving the form from a tab other than the Event Setup.

image

We can solve it in two ways.

  1. Either not letting the form submit via RHF.
  2. On Submit, checking the value and throwing an Error like we do when there are no multiple durations selected.

I prefer the 2nd approach because If we use the 1st approach The user will not get any indication of an error on tabs other than Event Setup. And it also looks more consistent.

If you would like the 2nd approach too. What Error message do you want to be shown?

image

@CLAassistant
Copy link

CLAassistant commented Aug 28, 2023

CLA assistant check
All committers have signed the CLA.

Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's address merge conflicts and unrelated changes first.

packages/features/form-builder/FormBuilder.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@Udit-takkar Udit-takkar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MehulZR do not push yarn.lock unless you change package.json.

Use this command to undo the changes in yarn.lock

Screenshot 2023-09-04 at 5 13 45 PM

@github-actions
Copy link
Contributor

This PR is being marked as stale due to inactivity.

@github-actions github-actions bot added the Stale label Oct 13, 2023
@Udit-takkar
Copy link
Contributor

@MehulZR can you fix the conflicts in this PR?

@github-actions github-actions bot removed the Stale label Oct 14, 2023
@@ -203,7 +205,7 @@ export const EventAdvancedTab = ({ eventType, team }: Pick<EventTypeSetupProps,
<RequiresConfirmationController
eventType={eventType}
seatsEnabled={seatsEnabled}
metadata={eventType.metadata}
metadata={formMethods.getValues("metadata")}
Copy link
Member

@hariombalhara hariombalhara Dec 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like the idea of sometimes getting the value from eventType and sometimes from formMethods. It makes the code complex for little gains.

Can we not just use formMethods everywhere. We could maybe do eventType = formMethods.getValues() and then we can keep on accessing values from eventType.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going with formMethods only is what I will prefer too, will look into it.

Copy link
Contributor Author

@MehulZR MehulZR Dec 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some cases when we need the original eventType prop alongside formMethods values.
For ex. having both the count of webhooks and other form values in the same component.

what we can do is instead of calling formMethods.getValues("some_property_name") everywhere, we just do formValues = formMethods.getValues() saving the execution calls and cleaning up things.
but formMethods.getValues isn't reactive (value change doesn't cause re-render & it doesn't subscribe to input changes), so for some cases we will still be using formMethods.watch().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested a bit with using the formValues strategy, as expected it is not reliable. We should use formMethods.getValues("some_prop")

Copy link
Member

@hariombalhara hariombalhara left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MehulZR I resolved the conflicts and left some more comments.

@keithwillcode keithwillcode added this to the v3.7 milestone Jan 10, 2024
@keithwillcode keithwillcode added the community Created by Linear-GitHub Sync label Jan 11, 2024
@keithwillcode keithwillcode modified the milestones: v3.7, v3.8 Jan 15, 2024
@joeauyeung
Copy link
Contributor

@MehulZR just a heads up there's more conflicts

@github-actions github-actions bot removed the 🚨 merge conflict This PR has a merge conflict that has to be addressed label Jan 23, 2024
@emrysal emrysal added Medium priority Created by Linear-GitHub Sync and removed Low priority Created by Linear-GitHub Sync labels Jan 23, 2024
@github-actions github-actions bot added the Low priority Created by Linear-GitHub Sync label Jan 23, 2024
joeauyeung
joeauyeung previously approved these changes Jan 23, 2024
Copy link
Contributor

@joeauyeung joeauyeung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Double checked everything and tested some fields. I fixed the noShowFeeEnabled since it was returning true even if Stripe was disabled.

I did notice one thing that's consistent in main as well but for managed event types when changing from a set availability and back to "member's default availability" the option doesn't change.
CleanShot 2024-01-23 at 12 22 09

I'm ok approving this PR since that bug wasn't caused by the changes made and it's such a huge QOL improvement.

@keithwillcode keithwillcode dismissed hariombalhara’s stale review January 23, 2024 18:46

Changes have been incorporated

@keithwillcode keithwillcode enabled auto-merge (squash) January 23, 2024 18:47
Copy link
Contributor

@emrysal emrysal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed merge conflicts, approved

@keithwillcode keithwillcode merged commit 0a2e275 into calcom:main Jan 24, 2024
29 of 37 checks passed
@MehulZR MehulZR deleted the fix_form branch February 17, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working community Created by Linear-GitHub Sync 🧹 Improvements Improvements to existing features. Mostly UX/UI Low priority Created by Linear-GitHub Sync Medium priority Created by Linear-GitHub Sync ⚡ Quick Wins A collection of quick wins/quick fixes that are less than 30 minutes of work
Projects
None yet
7 participants