globalbrain / sefirot

Global Brain Design System.
https://sefirot.globalbrains.com
MIT License
150 stars 12 forks source link

fix(validation): support reactivity for properties #518

Closed kiaking closed 7 months ago

kiaking commented 7 months ago

Reactivity in rules were not working. Seems like we need explicitly pass in reactive props into params.

export function requiredIf(
  condition: RequiredIfCondition,
  msg?: string
) {
  return createRule({
    async: true,
    params: { condition }, // <- This one!
    message: ({ lang }) => msg ?? message[lang],
    validation: (value) => baseRequiredIf(value, condition)
  })
}
netlify[bot] commented 7 months ago

Deploy Preview for sefirot-story ready!

Name Link
Latest commit 7a258d86b5ddb9afa7c55722ccae2f9a4f118153
Latest deploy log https://app.netlify.com/sites/sefirot-story/deploys/661f2dc68d22a400085eaf47
Deploy Preview https://deploy-preview-518--sefirot-story.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.

kiaking commented 7 months ago

@NozomuIkuta Could you test this one with the issue we had. It should work... and if it did, could you take over this PR and apply the same for other requiredIf rules? 🙏

netlify[bot] commented 7 months ago

Deploy Preview for sefirot-docs ready!

Name Link
Latest commit 7a258d86b5ddb9afa7c55722ccae2f9a4f118153
Latest deploy log https://app.netlify.com/sites/sefirot-docs/deploys/661f2dc713bd53000804a762
Deploy Preview https://deploy-preview-518--sefirot-docs.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.

nozomuikuta commented 7 months ago

@brc-dd

I applied the change to requiredHmsIf and requiredYmdIf rules. Would you check the PR again and publish it if it looks good to you?

kiaking commented 7 months ago

@brc-dd I need your approval to merge this, so, I'll leave it to you 👍