Only apply the social links block migration if there's a need for a migration#38561
Only apply the social links block migration if there's a need for a migration#38561youknowriad merged 3 commits intotrunkfrom
Conversation
|
Size Change: -70 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
|
@ntsekouras It seems we have a problem here (see the failing unit test). Basically, for blocks created with the old itemJuistification thing, there's no way for us to know whether the block need migration at the moment where isEligible is called :( because that information is not yet in any attribute (not even Maybe we could accept that social icons blocks created with justification applied in WP 5.8 become invalid. I'd appreciate any ideas. |
|
We could potentially add the "rawBlock" as a third argument of the |
|
isEligible function is very bad right now, it receives "raw attributes" (comment attributes) and "parsed inner blocks". It's not really coherent. The ideal solution potentially would have been to receive both |
You mean these two and loose the current second param(innerBlocks), correct? That would make sense and for back compat we could make an enhancement to just add a new object with the extra data. Having said that, even if we add this info I don't see how it can solve our problem. It seems more to me we would need an API with
This deprecation was added without taking into account that the
So IMO this deprecation could be deleted and accept the fact that blocks with the old |
7dc353c to
d53cb8f
Compare
|
@ntsekouras I removed the deprecation, I think that's fine, blocks won't be invalid right? since it will be just a custom class if I'm not wrong. |
ntsekouras
left a comment
There was a problem hiding this comment.
LGTM! Thanks!
I tested with the removed now markup(core__social-links__deprecated-1.html) and some variations - different classes. My observations in my previous testing are still the same. No invalidations and the only view that get's affected is in the editor.
closes #38549
closes #37542
By default all social links blocks were running through a block deprecation even if they were valid and didn't need the said migration. That's because the migration was checking if layout is undefined, but the layout is undefined by default (default value). The migration running was causing the
styleattribute to get removed because when the migration was added, the style attribute was not present on the "social links" block yet.This PR fixes by only running the migration on the blocks that really need it (old blocks with old justification classnames).