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

feat: Slug validation on update deployment #15

Merged
merged 42 commits into from
Sep 18, 2024

Conversation

zacharyblasczyk
Copy link
Member

No description provided.

packages/ui/src/form.tsx Outdated Show resolved Hide resolved
const onSubmit = form.handleSubmit(async (data) => {
await create.mutateAsync(data);
router.push(`/${data.slug}`);
watch((data, { name: fieldName }) => {
Copy link
Member

Choose a reason for hiding this comment

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

do you need to call this inside a useEffect?

Copy link
Member Author

Choose a reason for hiding this comment

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

I will look into this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think so, but I don't know 100% why.
I read the doc and it looks like it should be used with useffect if you want to watch specific fields, but we are using it in a "field array" populated by the form type.

They also show useFieldArray to add and remove items from the form, but I'm not doing that in this case. Our form is relatively more simple.

Screen Shot 2024-09-17 at 2 54 08 AM Screen Shot 2024-09-17 at 2 54 01 AM

@zacharyblasczyk zacharyblasczyk merged commit ac6ac43 into main Sep 18, 2024
10 checks passed
@zacharyblasczyk zacharyblasczyk deleted the zacharyb/slug-validation branch September 18, 2024 01:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants