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 manager crashing when dynamic zone entry field is not of type string #15241

Merged
merged 3 commits into from Dec 23, 2022
Merged

fix: Content manager crashing when dynamic zone entry field is not of type string #15241

merged 3 commits into from Dec 23, 2022

Conversation

gitstart
Copy link
Contributor

What does it do?

Add support for using a Numeric field as the Entry title for a dynamic zone display.

Why is it needed?

We call the .trim() method on the dynamic zone display's Entry title which works fine when the field is of String type. The Entry Title could be a number in some cases as highlighted in the related issue. These cases would cause a crash since the .trim() method is not available in type Number.

How to test it?

  • Add a dynamic zone as content type to a collection type.
  • Add a component containing a field of type number.
  • Configure the view of the component and use that field as entry title.
  • Go back to the content manager.
  • Add the component, and add type values within the numeric field.
  • Notice there are no errors or crash 🎉

Related issue(s)/PR(s)

Fixes #15210

Demo

Screen.Recording.2022-12-21.at.11.06.50.AM.mov

@codecov
Copy link

codecov bot commented Dec 22, 2022

Codecov Report

Base: 60.49% // Head: 60.49% // No change to project coverage 👍

Coverage data is based on head (c078ac2) compared to base (05be584).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #15241   +/-   ##
=======================================
  Coverage   60.49%   60.49%           
=======================================
  Files        1352     1352           
  Lines       33174    33174           
  Branches     6337     6337           
=======================================
  Hits        20070    20070           
  Misses      11271    11271           
  Partials     1833     1833           
Flag Coverage Δ
back 50.35% <ø> (ø)
front 65.05% <100.00%> (ø)
unit_back 50.35% <ø> (ø)
unit_front 65.05% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...ponents/DynamicZone/components/DynamicComponent.js 92.42% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@gitstart gitstart marked this pull request as ready for review December 22, 2022 05:28
@gu-stav gu-stav added source: core:content-manager Source is core/content-manager package pr: fix This PR is fixing a bug labels Dec 23, 2022
@gu-stav gu-stav added this to the 4.5.5 milestone Dec 23, 2022
@gu-stav gu-stav self-requested a review December 23, 2022 10:27
Copy link
Contributor

@gu-stav gu-stav left a comment

Choose a reason for hiding this comment

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

Thank you - that makes sense!

@gu-stav gu-stav merged commit b767d40 into strapi:main Dec 23, 2022
@gitstart
Copy link
Contributor Author

This PR was pushed through Gitstart, with contributions from @raph941, @phunguyenmurcul.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pr: fix This PR is fixing a bug source: core:content-manager Source is core/content-manager package
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Content manager is crashing when dynamic zone display field is not of type string
2 participants