fix: updating password ui bug #7775#7815
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
@joeshajan is attempting to deploy a commit to the cal Team on Vercel. A member of the Team first needs to authorize it. |
| >; | ||
|
|
||
| const PlainForm = <T extends FieldValues>(props: FormProps<T>, ref: Ref<HTMLFormElement>) => { | ||
| const PlainForm = (props: FormProps<{ apiError: string }>, ref: Ref<HTMLFormElement>) => { |
There was a problem hiding this comment.
I updated this FormProps<T> to FormProps<{ apiError: string }> if I don't do this the typescript will show a warning here form.clearErrors("apiError"); in line 343. So my doubt is will this cause any other issues?
There was a problem hiding this comment.
Yes it will, this isn't the right fix unfortunately - we can look at creating a "globalError" utility in the future but by not forwarding the T extends FieldValues it will disable/cause type errors elsewhere. This should be handled in the change password form. 🙏
📦 Next.js Bundle AnalysisThis analysis was generated by the next.js bundle analysis action 🤖
|
| Page | Size (compressed) |
|---|---|
global |
210.9 KB (🟡 +1 B) |
Details
The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!
Sixty-eight Pages Changed Size
The following pages changed size from the code in this PR compared to its base branch:
| Page | Size (compressed) | First Load | % of Budget (350 KB) |
|---|---|---|---|
/404 |
8.37 KB |
219.26 KB | 62.65% (+/- <0.01%) |
/[user] |
78.09 KB |
288.99 KB | 82.57% (+/- <0.01%) |
/[user]/[type] |
99.83 KB |
310.73 KB | 88.78% (+/- <0.01%) |
/[user]/[type]/embed |
99.86 KB |
310.75 KB | 88.79% (+/- <0.01%) |
/[user]/book |
191.29 KB |
402.19 KB | 114.91% (🟡 +0.01%) |
/[user]/embed |
78.16 KB |
289.06 KB | 82.59% (+/- <0.01%) |
/apps |
171.36 KB |
382.26 KB | 109.22% (🟡 +0.01%) |
/apps/[slug] |
195.08 KB |
405.98 KB | 115.99% (🟡 +0.02%) |
/apps/[slug]/[...pages] |
396.68 KB |
607.58 KB | 173.59% (🟡 +0.01%) |
/apps/categories |
156.26 KB |
367.16 KB | 104.90% (🟡 +0.02%) |
/apps/categories/[category] |
160.12 KB |
371.02 KB | 106.01% (🟡 +0.01%) |
/apps/installed/[category] |
201.27 KB |
412.17 KB | 117.76% (🟡 +0.02%) |
/auth/error |
19.24 KB |
230.14 KB | 65.75% (🟡 +0.01%) |
/auth/forgot-password |
25.63 KB |
236.53 KB | 67.58% (🟡 +0.01%) |
/auth/forgot-password/[id] |
40.95 KB |
251.85 KB | 71.96% (🟡 +0.01%) |
/auth/login |
40.1 KB |
251 KB | 71.71% (🟡 +0.02%) |
/auth/logout |
7.56 KB |
218.46 KB | 62.42% (+/- <0.01%) |
/auth/setup |
103.52 KB |
314.42 KB | 89.84% (🟡 +0.01%) |
/availability |
159.47 KB |
370.37 KB | 105.82% (🟡 +0.01%) |
/availability/[schedule] |
276.27 KB |
487.17 KB | 139.19% (🟡 +0.01%) |
/availability/troubleshoot |
156.94 KB |
367.84 KB | 105.10% (🟡 +0.01%) |
/booking/[uid] |
131.49 KB |
342.38 KB | 97.82% (🟡 +0.02%) |
/bookings/[status] |
269.14 KB |
480.04 KB | 137.15% (🟡 +0.02%) |
/d/[link]/[slug] |
99.48 KB |
310.38 KB | 88.68% (+/- <0.01%) |
/d/[link]/[slug]/embed |
99.51 KB |
310.41 KB | 88.69% (+/- <0.01%) |
/d/[link]/book |
190.94 KB |
401.84 KB | 114.81% (🟡 +0.01%) |
/event-types |
354.18 KB |
565.08 KB | 161.45% (🟡 +0.02%) |
/event-types/[type] |
386.72 KB |
597.62 KB | 170.75% (🟡 +0.01%) |
/getting-started/[[...step]] |
334.19 KB |
545.09 KB | 155.74% (🟡 +0.01%) |
/more |
155.88 KB |
366.78 KB | 104.79% (🟡 +0.02%) |
/settings/admin |
161.32 KB |
372.22 KB | 106.35% (🟡 +0.01%) |
/settings/admin/apps |
194.22 KB |
405.12 KB | 115.75% (🟡 +0.01%) |
/settings/admin/apps/[category] |
194.21 KB |
405.11 KB | 115.74% (🟡 +0.02%) |
/settings/admin/impersonation |
161.6 KB |
372.5 KB | 106.43% (🟡 +0.01%) |
/settings/billing |
161.44 KB |
372.33 KB | 106.38% (🟡 +0.01%) |
/settings/developer/api-keys |
190.59 KB |
401.49 KB | 114.71% (🟡 +0.01%) |
/settings/developer/webhooks |
163.93 KB |
374.83 KB | 107.09% (🟡 +0.02%) |
/settings/developer/webhooks/[id] |
194.77 KB |
405.67 KB | 115.91% (🟡 +0.01%) |
/settings/developer/webhooks/new |
194.64 KB |
405.54 KB | 115.87% (🟡 +0.01%) |
/settings/my-account/appearance |
175.4 KB |
386.3 KB | 110.37% (🟡 +0.01%) |
/settings/my-account/calendars |
195.62 KB |
406.52 KB | 116.15% (🟡 +0.01%) |
/settings/my-account/conferencing |
167.2 KB |
378.1 KB | 108.03% (🟡 +0.01%) |
/settings/my-account/general |
270.5 KB |
481.4 KB | 137.54% (🟡 +0.01%) |
/settings/my-account/profile |
429.1 KB |
640 KB | 182.86% (🟡 +0.01%) |
/settings/security/impersonation |
163.48 KB |
374.38 KB | 106.96% (🟡 +0.02%) |
/settings/security/password |
196.77 KB |
407.67 KB | 116.48% (🟡 +0.01%) |
/settings/security/sso |
171.17 KB |
382.07 KB | 109.16% (🟡 +0.02%) |
/settings/security/two-factor-auth |
165.93 KB |
376.83 KB | 107.66% (🟡 +0.02%) |
/settings/teams |
161.07 KB |
371.97 KB | 106.28% (🟡 +0.01%) |
/settings/teams/[id]/appearance |
175.42 KB |
386.32 KB | 110.38% (🟡 +0.01%) |
/settings/teams/[id]/billing |
161.3 KB |
372.2 KB | 106.34% (🟡 +0.02%) |
/settings/teams/[id]/members |
301.96 KB |
512.86 KB | 146.53% (🟡 +0.01%) |
/settings/teams/[id]/onboard-members |
74.16 KB |
285.06 KB | 81.45% (🟡 +0.01%) |
/settings/teams/[id]/profile |
273.8 KB |
484.7 KB | 138.48% (🟡 +0.02%) |
/settings/teams/[id]/sso |
171.26 KB |
382.16 KB | 109.19% (🟡 +0.01%) |
/settings/teams/new |
113.45 KB |
324.35 KB | 92.67% (🟡 +0.01%) |
/signup |
25.5 KB |
236.4 KB | 67.54% (🟡 +0.01%) |
/team/[slug] |
80.63 KB |
291.53 KB | 83.29% (+/- <0.01%) |
/team/[slug]/[type] |
99.48 KB |
310.38 KB | 88.68% (+/- <0.01%) |
/team/[slug]/[type]/embed |
99.51 KB |
310.41 KB | 88.69% (+/- <0.01%) |
/team/[slug]/book |
190.94 KB |
401.84 KB | 114.81% (🟡 +0.01%) |
/team/[slug]/embed |
80.69 KB |
291.59 KB | 83.31% (+/- <0.01%) |
/teams |
156.1 KB |
367 KB | 104.86% (🟡 +0.01%) |
/video/meeting-ended/[uid] |
22.77 KB |
233.67 KB | 66.76% (+/- <0.01%) |
/video/meeting-not-started/[uid] |
22.41 KB |
233.31 KB | 66.66% (+/- <0.01%) |
/video/no-meeting-found |
6.6 KB |
217.5 KB | 62.14% (+/- <0.01%) |
/workflows |
169 KB |
379.9 KB | 108.54% (🟡 +0.01%) |
/workflows/[workflow] |
298.85 KB |
509.75 KB | 145.64% (🟡 +0.02%) |
Details
Only the gzipped size is provided here based on an expert tip.
First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.
Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis
The "Budget %" column shows what percentage of your performance budget the First Load total takes up. For example, if your budget was 100kb, and a given page's first load size was 10kb, it would be 10% of your budget. You can also see how much this has increased or decreased compared to the base branch of your PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this. If you see "+/- <0.01%" it means that there was a change in bundle size, but it is a trivial enough amount that it can be ignored.
| >; | ||
|
|
||
| const PlainForm = <T extends FieldValues>(props: FormProps<T>, ref: Ref<HTMLFormElement>) => { | ||
| const PlainForm = (props: FormProps<{ apiError: string }>, ref: Ref<HTMLFormElement>) => { |
There was a problem hiding this comment.
Yes it will, this isn't the right fix unfortunately - we can look at creating a "globalError" utility in the future but by not forwarding the T extends FieldValues it will disable/cause type errors elsewhere. This should be handled in the change password form. 🙏
|
By changing |
|
Hey @emrysal what do you think about this solution? |
|
A lot better! I wonder what happens when; on successful submission, the reset() function is used. Thinking about it that behaviour may feel very natural in all forms form.reset(); |
Really sorry @emrysal I don't get what you meant. Are you asking me to change something? |
|
@joeshajan Well it was more a thought from my end, if you remove the if clause and then add just a reset() - I wonder if that works "better" or similar behaviour. |
Ok got it @emrysal. but if we reset the form before submitting I assume that values inside the fields will be removed and then there is nothing to submit. So I think |
emrysal
left a comment
There was a problem hiding this comment.
Yeah you're right, probably not the right fix for now. Merging this 🙇 Thank you!
|
Thanks @emrysal 🙂 |
What does this PR do?
Fixes #7775
Currently, when the old password and new password are the same or the old password is incorrect, the server returns an error. We use the
setErrormethod from theuseFormhook to set anapiError. However, since thisapiErroris not linked to any of the input fields, it will not trigger validation again when the user types. As a result, the handleSubmit function will not be triggered by React Hook Form because the error is set to true.To solve this issue, we can check if
apiErroris true when we submit the form. If it's true, we can clear it before submitting it. This approach is working well.Recording: Link to loom video of the screen recording
Environment: Staging(main branch) / Production
Type of change
How should this be tested?