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: content edit #664

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Conversation

IkbelTalebHssan
Copy link
Collaborator

@IkbelTalebHssan IkbelTalebHssan commented Feb 3, 2025

Motivation

We need to ensure that content["dynamicFields"] is defined before trying to access its properties.

Fixes (issue)

Type of change:

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added unit tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Copy link
Contributor

@marrouchi marrouchi left a comment

Choose a reason for hiding this comment

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

The content type "add" form, needs to includes the dynamic fields so that the user doesn't have to edit again to configure those.

API side, we need to add a default value.

@abdou6666 abdou6666 self-requested a review February 4, 2025 13:10
@IkbelTalebHssan
Copy link
Collaborator Author

The content type "add" form, needs to includes the dynamic fields so that the user doesn't have to edit again to configure those.

API side, we need to add a default value.

Thank you for the review 🙏
Updates are done ✔️

Comment on lines +115 to +117
{...register("name", {
required: t("message.name_is_required"),
})}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @IkbelTalebHssan, i have noticed that the input helperText attribute is accidentally removed

Suggested change
{...register("name", {
required: t("message.name_is_required"),
})}
{...register("name", {
required: t("message.name_is_required"),
})}
helperText={errors.name ? errors.name.message : null}

Copy link
Collaborator Author

@IkbelTalebHssan IkbelTalebHssan Feb 4, 2025

Choose a reason for hiding this comment

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

accidentally removed

Thank you @yassinedorbozgithub for the review 🙏
Fixed ✔️

Comment on lines 60 to 72
useEffect(() => {
if (open) reset();
}, [open, reset]);

useEffect(() => {
if (data) {
reset({
name: data.name,
});
} else {
reset();
}
}, [data, reset]);
Copy link
Contributor

Choose a reason for hiding this comment

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

As a general rule, useEffect() should be place at the end, before the "return"

} else {
createContentType(params);
createContentType({ ...params, name: params.name || "" });
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
createContentType({ ...params, name: params.name || "" });
createContentType({ ...params, name: params.name || "" });

The content type "name" attribute should not be empty. In which case are getting it empty?

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.

🐛 [BUG] - Content Edit is broken
4 participants