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: add domain parser hook and domain condition #5413

Merged
merged 4 commits into from
Apr 16, 2024

Conversation

jainpawan21
Copy link
Member

@jainpawan21 jainpawan21 commented Apr 16, 2024

What changed? Why was the change needed?

Add useDomainParser Hook
handle invalid domain field value

Screenshots

Expand for optional sections

Related enterprise PR

Special notes for your reviewer

Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for dev-web-novu ready!

Name Link
🔨 Latest commit bc391f4
🔍 Latest deploy log https://app.netlify.com/sites/dev-web-novu/deploys/661e48ab59b2c300081b9f07
😎 Deploy Preview https://deploy-preview-5413--dev-web-novu.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link

netlify bot commented Apr 16, 2024

Deploy Preview for novu-design ready!

Name Link
🔨 Latest commit bc391f4
🔍 Latest deploy log https://app.netlify.com/sites/novu-design/deploys/661e48ab5c1ad3000888dcd0
😎 Deploy Preview https://deploy-preview-5413--novu-design.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@jainpawan21 jainpawan21 marked this pull request as ready for review April 16, 2024 09:00
Copy link
Contributor

@SokratisVidros SokratisVidros left a comment

Choose a reason for hiding this comment

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

@jainpawan21 I approve this so that we can ship but PTAL at my comments. I think it's worth using the validate function.

@@ -161,12 +174,6 @@ export function QuestionnaireForm() {
<Controller
name="domain"
control={control}
rules={{
Copy link
Contributor

Choose a reason for hiding this comment

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

Alternatively, we can add it as a custom rule and let it trigger as part of react-hook-form lifecycle. For example:

rules = {{
  validate: {
    isValidDomain: v => parse(v)...
  }
}}```

For more information PTAL https://www.react-hook-form.com/api/useform/register/#options:~:text=%7D%0A/%3E-,validate,-Function%20%7C%20Object

I am not sure what other benefits this gives us but If I had to guess it would make it simpler to trigger all validations at once on form click or maybe on blur if we want to.

apps/web/src/pages/auth/components/QuestionnaireForm.tsx Outdated Show resolved Hide resolved
@jainpawan21 jainpawan21 merged commit ac51cce into next Apr 16, 2024
12 of 14 checks passed
@jainpawan21 jainpawan21 deleted the fix/domain-parser-hook branch April 16, 2024 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants