wp-rocket icon indicating copy to clipboard operation
wp-rocket copied to clipboard

Preload fonts leftovers from the previous feature version should be cleaned

Open MathieuLamiot opened this issue 6 months ago • 9 comments

Context

Some deprecated code was identified and reported here. This code is not useful anymore and should be cleaned.

Dependencies

This should happen after #7445 is closed.

Expected behavior

Remove unused code:

  • https://github.com/wp-media/wp-rocket/blob/3a1f32bb4a9b8cd40e32c682a86d888a71ec4825/inc/admin/upgrader.php#L145
  • https://github.com/wp-media/wp-rocket/blob/3a1f32bb4a9b8cd40e32c682a86d888a71ec4825/inc/Engine/Preload/Fonts.php#L102
  • https://github.com/wp-media/wp-rocket/blob/3a1f32bb4a9b8cd40e32c682a86d888a71ec4825/inc/Plugin.php#L101

Acceptance Criteria

  • No errors on new installs
  • Happy path of auto-preload fonts feature working as expected from a fresh install (check on a couple of pages).

MathieuLamiot avatar Jun 04 '25 21:06 MathieuLamiot

Skipping grooming as it's pretty straightforward.

MathieuLamiot avatar Jun 04 '25 21:06 MathieuLamiot

@MathieuLamiot @wp-media/product What about the old preload fonts values or the option in general. More context here: https://group-onecom.slack.com/archives/C08EFCYRQ2X/p1749106324308149?thread_ts=1749053738.147779&cid=C08EFCYRQ2X

jeawhanlee avatar Jun 06 '25 09:06 jeawhanlee

I would say we can clean them from the DB, if they exist, when updating to 3.19.1?

MathieuLamiot avatar Jun 06 '25 09:06 MathieuLamiot

Ok, should Implement this now or it's a question? 😀

jeawhanlee avatar Jun 06 '25 09:06 jeawhanlee

Ahah, if you think that's not a dumb idea, then let's go for it and implement it in this PR 👍 I'm just not sure 100% that we indeed don't use that data anymore 😬 You probably know better on that 😄

MathieuLamiot avatar Jun 06 '25 11:06 MathieuLamiot

I would say we can clean them from the DB, if they exist, when updating to 3.19.1?

@MathieuLamiot @jeawhanlee Does this mean that if a user rollback from 3.19 then those values won't exist in UI?

Mai-Saad avatar Jun 10 '25 06:06 Mai-Saad

Yes, correct @Mai-Saad , good catch. It might be better to keep this for 3.20 then. Let's get @DahmaniAdame's decision here

MathieuLamiot avatar Jun 10 '25 06:06 MathieuLamiot

@MathieuLamiot @Mai-Saad We already do the same here for old dns-prefetch in favor of the new preconnect to external domains.

jeawhanlee avatar Jun 10 '25 07:06 jeawhanlee

Good catch, Mai. The decision to discard those settings was based on the assumption that keeping them would be a regression if still applied. The possibility of a rollback was overlooked.

Users should indeed retain access to their settings if rolling back. It's best if we preserve them this time around.

This would apply to preconnect to external domains as well.

Introducing a history or versioning of settings changes could help address this effortlessly in the future. Until we do, we should do an effort preserving settings.

DahmaniAdame avatar Jun 12 '25 07:06 DahmaniAdame