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

Update @wordpress and React packages [MAILPOET-5102] #4786

Merged
merged 46 commits into from Mar 15, 2023

Conversation

costasovo
Copy link
Contributor

@costasovo costasovo commented Mar 10, 2023

Description

This PR updates @wordpres/* and React packages. React update is included because some of the wordpress packages have already updated to React 18 and use the new functionality.

Note: After the update, there is the dev console for dev builds.

Warning: ReactDOM.render is no longer supported in React 18. Use createRoot instead. Until you switch to the new API, your app will behave as if it's running React 17. Learn more: https://reactjs.org/link/switch-to-createroot

This is expected for now and will be addressed in a follow-up ticket. Switching to the new render API will turn on the automatic batching feature, and it may cause some issues.

Code review notes

N/A

QA notes

This changes a lot of JS libraries we build on, so potentially, this could cause issues in the whole plugin.
Five parts of the plugin are influenced the most because they heavily use these packages:

  1. Automation - some visual changes are expected
  2. Form Editor - some visual changes are expected
  3. Plugin settings
  4. Dynamic segments editor (the form for creating segments)
  5. Settings panel of the coupon block - some small visual changes are expected

Linked PRs

https://github.com/mailpoet/mailpoet-premium/pull/692 - related changes in the premium plugin
mailpoet/wordpress-images#43 - update of the image for CI builds

Linked tickets

MAILPOET-5102

After-merge notes

This also updates the node version in the dev environment so ping devs to update the local node and rebuild the WordPress image in their dev env.

@github-actions
Copy link

Pull reviewers stats

Stats of the last 90 days for mailpoet:

User Total reviews Time to review Total comments
MailPoet-Staff
🥇
1
57m
0
xknown
🥈
1
1h 36m
1
samnajian
🥉
16
6h 1m
26
brezocordero
8
7h 7m
7
johnolek
9
10h 29m
23
costasovo
17
14h 23m
36
▀▀
NeosinneR
2
16h 7m
1
websupporter
14
16h 48m
2
lysyjan
22
17h 18m
9
triple0t
22
18h 19m
31
▀▀
alex-mailpoet
4
20h 5m
0
JanJakes
21
1d 8m
33
▀▀
rodrigoprimo
10
1d 3h 43m
11
veljkho
7
2d 1h 41m
▀▀
0
Aschepikov
102
▀▀▀▀
3d 20h 54m
▀▀▀
0

Copy link
Contributor

@JanJakes JanJakes left a comment

Choose a reason for hiding this comment

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

Great job! 👏

I added a few small notes. I can verify these myself, given that you'll be AFK, @costasovo.
Thanks!

@@ -38,7 +38,7 @@ export function OptionButton({
</Button>
{slots.length > 0 &&
slots.map(({ key, slot }) => (
<Fragment key={`slot-${key}`}>{slot}</Fragment>
<Fragment key={`slot-${key}`}>{slot()}</Fragment>
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, did this work before? I also wonder if there's a difference between {slot()} and <Slot>...

}}
position="bottom center"
Copy link
Contributor

Choose a reason for hiding this comment

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

More of a note to self to check if the dropdown positioning in the UI somehow changed.

["@babel/preset-react", { "runtime": "automatic" }],
"@babel/preset-env"
"@babel/preset-env",
["@babel/preset-typescript", { "allowDeclareFields": true }]
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder whether we should review the preset order in any other config (for any reason)...

import { DefaultSidebar } from './default_sidebar';
import { PlacementSettingsSidebar } from './placement_settings_sidebar';
import { store } from '../../store';

// workaround for block editor store useSelect
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this later removed (moved to types/... as per 5638e31)? Need to check.

@@ -8,6 +12,14 @@ import { BlockSettings } from './block_settings.jsx';
import { SidebarHeader } from './sidebar_header';
import { store } from '../../store';

// workaround for block editor store useSelect
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this later removed (moved to types/... as per 5638e31)? Need to check.

@JanJakes JanJakes force-pushed the update-wordpress-deps-v3 branch 2 times, most recently from 050571d to a533f18 Compare March 14, 2023 08:37
JanJakes
JanJakes previously approved these changes Mar 14, 2023
@Aschepikov
Copy link
Collaborator

Console error when I am pressing on add a condition

image

and some tiny issues

  1. In the automations incorrect tags list
    image
    On prod
    image

  2. Automations background is not blurred when an element is deleting
    image
    On prod
    image

  3. On the prod all lists in the trigger, add/remove tags and lists are open when you are adding those actions, on this branch they are closed, I am not sure how it is better
    image
    On prod
    image

  4. Text in some field names is in capslock
    image
    image
    On prod
    image

  5. Name of the automation is blue on this branch
    image
    On prod
    image

  6. Issue with the + button in the form editor
    image
    On prod
    image

  7. No space in the size heading
    image
    On prod
    image

  8. Font family is bold on prod
    image
    On prod
    image

  9. Lists in the colors and message colors are different from the prod, and should be disabled when there is no chosen color
    image

  10. Different UI of buttons in the color settings
    image
    image
    On prod
    image

  11. Different UI in the template settings
    image

@JanJakes
Copy link
Contributor

Thanks, @Aschepikov! Great catches 👏

Console error when I am pressing on add a condition

This is strange, I can't replicate it. Tried both with the premium plugin enabled and disabled. Did you have the correct premium plugin JS (caches and stuff) when you were testing that? I don't know how to reproduce it. On your screenshot, I don't see the "all of", "any of" switch, so I'd guess the premium plugin is not active, or the JS is not working. Should I check it on your website ❓

Issues:

  1. In the automations incorrect tags list

Trying to play with the tags, but can't reproduce this. Do you have any steps to reproduce? Or should I check it on your website❓

  1. Automations background is not blurred when an element is deleting

Indeed, it seems that Gutenberg doesn't create the blur anymore. That's fine, we'll follow whatever they do ✅

  1. On the prod all lists in the trigger, add/remove tags and lists are open when you are adding those actions, on this branch they are closed, I am not sure how it is better

That was a bug in Gutenberg components, now it's fixed, which is desired (enabled left image, disabled right image) ✅

  1. Text in some field names is in capslock

That seems to be the Gutenberg style for labels in the sidebar. We can see it in the post editor itself, as well as in the individual components, such as InputControl

  1. Name of the automation is blue on this branch

Good catch, this seems to differ from Gutenberg. I need to investigate 🐞

  1. Issue with the + button in the form editor

That looks like a bug 🐞

  1. No space in the size heading

Also a bug 🐞

  1. Font family is bold on prod

That seems to be a style of the underlying Gutenberg component

  1. Lists in the colors and message colors are different from the prod, and should be disabled when there is no chosen color

This seems to work exactly as in the WP post editor for me, so I'd say it's OK ✅

Screenshot 2023-03-15 at 15 15 19 Screenshot 2023-03-15 at 15 15 28
  1. Different UI of buttons in the color settings

Same here, looks like WP post editor, so I think OK ✅

  1. Different UI in the template settings

We could fix this, but isn't the new UI actually better? It's probably more translation-friendly as well (more space). I'd keep it on two lines ✅

@Aschepikov
Copy link
Collaborator

Aschepikov commented Mar 15, 2023

@JanJakes For the first error you can check it here https://alex.qawp.net/wp-admin/admin.php?page=mailpoet-segments#/new-segment
I reinstalled plugins and cleaned all cache, I mentioned in slack that it is reproducible just on this site, maybe some problem with site

@Aschepikov
Copy link
Collaborator

Aschepikov commented Mar 15, 2023

With tags, I can't reproduce it after reinstalling too, maybe there was a lag with installing or a cache problem.
I agree with all your comments.

Just the 4 with capslock, there are some headings without capslock and I remember that there was a ticket with fixing some capslock headings in forms editors. Looks a lit bit strange for me this capslock, but yes I checked it in wp posts and they have it too.
image
image

@JanJakes
Copy link
Contributor

@Aschepikov I fixed 5, 6, 7, and also 11, and another small issue.

Just the 4 with capslock, there are some headings without capslock and I remember that there was a ticket with fixing some capslock headings in forms editors. Looks a lit bit strange for me this capslock, but yes I checked it in wp posts and they have it too.

Headers in the panels are not uppercased. It's only labels that are uppercased.

Just need to check the first issue and all else should be fine.

@JanJakes
Copy link
Contributor

@Aschepikov I also likely fixed number 1 — improved the code to avoid any race conditions or duplicates. I also found a new issue (that the first time the "add tag" select was focused, it showed no autocomplete) and fixed it too.

costasovo and others added 12 commits March 15, 2023 17:13
Most of the WordPress packages already upgraded to react 18 and use
new hooks so we need to upgrade also the react libs.
[MAILPOET-5102]
This commit fixes CSS which was preventing clicking the custom font select component
and suppresses a deprecation warning by adding __nextUnconstrainedWidth property.
[MAILPOET-5102]
After the updates some packages that we use in zip build don't work
with node17. This commit updates dev env to the most recent node version.
[MAILPOET-5102]
JanJakes and others added 24 commits March 15, 2023 17:15
Both store name and store descriptor typings should work in all cases.

[MAILPOET-5102]
This fixes the "fontSizeValue.startsWith is not a function" error. It seems that the font size picker
now always expects strings, while the values from SETTINGS_DEFAULTS could be numbers,
and we've been using numbers throughout our codebase as well.

This also enables the usage of any font size units, such as em and rem.

This may be related to: WordPress/gutenberg#44857

[MAILPOET-5102]
Copy link
Collaborator

@Aschepikov Aschepikov left a comment

Choose a reason for hiding this comment

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

Great job!

@Aschepikov Aschepikov merged commit eb74b55 into trunk Mar 15, 2023
2 checks passed
@Aschepikov Aschepikov deleted the update-wordpress-deps-v3 branch March 15, 2023 20:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants