This repository was archived by the owner on Feb 23, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 215
Use Preact to render Reviews blocks frontend #4463
Closed
Closed
+238
−93
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Contributor
|
Size Change: +2.75 kB (0%) Total Size: 1.07 MB
ℹ️ View Unchanged
|
24e976d to
47eafd5
Compare
Contributor
Author
|
Closing this PR because we decided not to add Preact to any of our blocks and instead continue relying on |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
block-type: reviews
Issues related to all of the reviews related blocks.
focus: performance
The issue/PR is related to performance.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Part of #4245.
This PR adds a new Webpack config that generates frontend scripts using Preact instead of React and updates the Reviews blocks to use it.
Currently, Preact is bundled into the built file, but if in the future we use Preact in more blocks, we can consider externalizing it so it's only downloaded once. Jetpack also uses Preact for the Jetpack Search, so the win of externalizing would be even greater for sites using Jetpack and WC.
I did a quick test on the amount of scripts required to render a page only containing the All Reviews blocks in
trunkand in this branch with Storefront:trunkExcluding all scripts unrelated to the block (jQuery, WC core scripts, etc.), it looks like this:
trunkScripts required in `trunk` to render the All Reviews block in the frontend
Scripts required in this branch to render the All Reviews block in the frontend
How to test the changes in this Pull Request:
For devs (no need to include this in the release testing steps)
/wp-content/plugins/gutenberg/build/element/index.min.jsreactreact-dom"./assets/js/settings/blocks/**"from the list ofsideEffects. That was introduced in this PR: Fix build issues for production builds #2042. I wasn't able to reproduce the issues mentioned in that PR, but would be good to double-check. cc @nerradFor users (include this in the release testing steps)
Load more, etc. and verify there are no regressions.Changelog