-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Simplify quote values #5265
Simplify quote values #5265
Conversation
@youknowriad @aduth Not sure if the structure of the value attributes had a reason or if it was just so to work with |
Also makes me wonder if we should/could warn block authors if they do something similar (return new arrays/objects on every render). |
{ value && value.map( ( paragraph, i ) => | ||
<p key={ i }>{ paragraph.children && paragraph.children.props.children }</p> | ||
) } | ||
{ [ value ] /* Prevent keys warning... */ } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should do something else here... :)
Nice exploration :), I like these improvements.
The structure was not necessary, it was there because the idea was that you can use any submatcher to your |
I'm not as fine with the change. Notably the fact that it breaks the gallery block which leverages the generalized behavior of |
Over the weekend I started on a branch to explore eliminating |
@aduth So what would you propose instead? I don't really care that much how the array of elements is created, just that it's not this weird structure with |
Not sure I understand, the generalized behavior is still here, this PR introduces a new behavior in the If you have |
related discussion in #2854 |
Actually, now that we're talking about it, I think the best simplification would be to upgrade the blocks to use block nesting. |
Okay, how do me move this forward? Make it nested? Is this a valuable intermediate step or shall I close this PR. What I'd like is to get rid of the isEqual check though which is there only for the quote black because it's calculating new values all the time. |
I'm not a fan of the relationship between |
Continuing in #6054. |
Description
See #5252.
Currently there are
isEqual
checks on a React objects every time a quote block re-renders. This branch avoids these isEqual checks in theRichText
component by changing the quote values to not get recalculated every timerender
is called.How Has This Been Tested?
Screenshots (jpeg or gifs if applicable):
Types of changes
Checklist: