-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Refactor Embed Edit component: Class component to Function component #22846
Conversation
Size Change: -459 B (0%) Total Size: 1.13 MB
ℹ️ View Unchanged
|
Taking a quick look, this seems like good work. @ZebulanStanphill, can you lead the review? I would say that one thing to pay special attention to is performance: making sure there aren't clear regressions, and assess whether and where we might benefit from |
Just saw that the e2e tests are failing in CI. Quick look told me that it's relevant. I'll try to fix it. But it will be the first time I'll touch e2e tests. So please bear with me. Thanks 🙂 |
import { __, sprintf } from '@wordpress/i18n'; | ||
import { Component } from '@wordpress/element'; | ||
import { useState, useEffect } from '@wordpress/element'; |
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.
Nitpick: I prefer imports to be in alphabetical order. (There's no standard one way or the other; it's just a personal preference of mine.)
Example:
import { useEffect, useState } from '@wordpress/element';
import { __, sprintf } from '@wordpress/i18n';
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.
Either let's make a linting rule, or not bother with this at all. :) I personally don't feel like wasting time on this.
@desaiuditd, @ZebulanStanphill: do you see anything missing from this PR, or can we merge? |
@swissspidy is this PR something you can help out with? As the PR is very slowly moving forward. Thanks. |
Co-authored-by: Zebulan Stanphill <[email protected]>
86e355c
to
5444d51
Compare
Rebased against |
@mcsf Thanks. I was away from my dev machine for awhile. I'll take a look at this today. |
Just checked this. I think this is looking good to me. Ready for review/merge. I found a bug in the Try Again button in the edit mode. However, I verified that it's happening on master branch as well and bug is coming from
|
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.
Thanks for working on this!
What is the overall path forward in regards to the embed feature? |
Description
This refactor stems from #21789 where improvements for Embed block UX are discussed. But before we actually work on improvements, this seemed like a good opportunity to convert the component into a function component so that React hooks can be used within the component later.
How has this been tested?
Tested locally to make sure embed block works properly with all the basic use cases like changing the url, block transformation, switching between preview and placeholder etc.
Types of changes
Code refactoring to convert the edit component of Embed block into a function component. Non-breaking change. No behaviour change is expected.
Checklist: