strapi
strapi copied to clipboard
DynamicZone - extend FriendlyName with MainValue
...like RepeatableComponent
This commit fixes #12499
What does it do?
Show the MainValue of the Components of a DynamicZone in the AccordionToggle.
Why is it needed?
To be able to distingish the Dzone components without unfold them.
How to test it?
- Create a Component
- Create a Collection
- add DynamicZone
- add the Component
- add DynamicZone
- Edit the Collection
- edit DZone
- add more Component instance
- edit the mainField
- check the AccordionToggle changes
- edit DZone
Sample:

Related issue(s)/PR(s)
Related issue: #12499
@godzzo Thanks for your contribution again :) We had a quick look into the PR today and think it's a nice addition. I'll check & review your code in the coming days.
Codecov Report
Base: 59.33% // Head: 59.33% // Decreases project coverage by -0.00% :warning:
Coverage data is based on head (
ab1d9e6) compared to base (a13b60d). Patch coverage: 58.82% of modified lines in pull request are covered.
Additional details and impacted files
@@ Coverage Diff @@
## main #12500 +/- ##
==========================================
- Coverage 59.33% 59.33% -0.01%
==========================================
Files 1338 1342 +4
Lines 32724 32757 +33
Branches 6197 6199 +2
==========================================
+ Hits 19417 19436 +19
- Misses 11438 11450 +12
- Partials 1869 1871 +2
| Flag | Coverage Δ | |
|---|---|---|
| front | 63.63% <58.82%> (-0.01%) |
:arrow_down: |
| unit | 49.80% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Impacted Files | Coverage Δ | |
|---|---|---|
| ...s/DynamicZone/components/Component/utils/select.js | 36.36% <36.36%> (ø) |
|
| ...micZone/components/Component/hooks/useMainValue.js | 58.33% <58.33%> (ø) |
|
| .../DynamicZone/components/Component/utils/connect.js | 66.66% <66.66%> (ø) |
|
| ...mponents/DynamicZone/components/Component/index.js | 47.54% <100.00%> (+1.77%) |
:arrow_up: |
| ...ts/DynamicZone/components/Component/utils/index.js | 100.00% <100.00%> (ø) |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
This pull request has been mentioned on Strapi Community Forum. There might be relevant details there:
https://forum.strapi.io/t/component-entry-titel-display-in-dynamic-zone/15478/3
Any chance this will get reviewed and merged? Would love to be able to use this feature
@sjaga003 I'll do another review as soon as possible - I think I'll manage it by next week.
@sjaga003 I'll do another review as soon as possible - I think I'll manage it by next week.
Nice, we need this.
review + merge, pretty please 🙏
We look forward to this addition :pray:
Any update on this review? Its a necessary addition 🙏
This is the main pain point for our editors. Please give it another look.
This is the main pain point for our editors. Please give it another look.
You can use patch package to fix this for now. We've been doing this to accommodate the editors.
Any update on this getting merged in?
Hey all, let me request and update from the team
@derrickmehaffy I'm on it. The required design-System work is done, but I have to find some time to review this PR again.
@derrickmehaffy I'm on it. The required design-System work is done, but I have to find some time to review this PR again.
No problem thank you!
Hello 👋🏼 I've checked the PR again today, because now all required changes to the Accordion component are done, so that long titles don't overflow any longer.
I've found a couple of bugs:
- only fields of type "text" as main-field are extracted properly; all the others lead to
1 - all fields of type !== 'text' update on save, whereas type == 'text' updates on keydown
- if no value was extracted, the seperator
-is still rendered
Would you still be available to fix those?
Hello @gu-stav !
Yes! I have tried to fix the 3 bugs you mentioned.
Please review it.
- only fields of type "text" as main-field are extracted properly; all the others lead to 1
- if it is not a title field (you could not choose as title of the DZone) then it will be the
idfield - that is why 1 is the value (of
id) if you save that...
- if it is not a title field (you could not choose as title of the DZone) then it will be the
- all fields of type !== 'text' update on save, whereas type == 'text' updates on keydown
idonly got value if you save, otherwise will be update on keydown if I saw it correctly- I omit the id as MainField value, that is the fix about
- if no value was extracted, the seperator - is still rendered
- fixed