-
Notifications
You must be signed in to change notification settings - Fork 1
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
Tracking Issue #20
Comments
Not anymore. @ockham has been working on that 🙂 |
Very excited about this project! Count with us with anything we can help with. 🙂
@michalczaplinski, just wanted to give a heads-up that the All Products block is a block that might be refactored in the future as we make progress towards a new standard to render Product grids. Currently we are in early explorations and we don't have any plans in the short term to refactor or migrate the All Products block to the new Product grid; however, I wanted to mention this is a possibility in case you want to focus on some other blocks. |
Thank you, Albert! 🙌
Roger that! I think we'll try to see how to hydrate it anyway because it should be (relatively) simple and should also inform how we handle more complex blocks. I see that @ockham has already taken a stab at it in #21 😃 |
I will start working on this one 😄 |
We've merged the first two PRs 🥳 :
|
I added a couple of issues to keep working on 😄 |
I'm going to try reimplementing the Checkout and inner blocks from scratch using only the BHE API. I want to test if it is easy to implement the same without using I'll open a draft PR and link it here soon. 🙂 |
Before starting with the Checkout block, I wanted to test how easy it is to add new blocks to the repository. For that, I created a PR porting all the BHE blocks and context files. I also added the BHE repo as a dependency in |
I think I forgot to mention this (apologies for that): The reason I wanted to reimplement Checkout from scratch (see #20 (comment)) is because parent blocks (e.g., Cart and Checkout) take over their content and render a different HTML tree, thus forcing inner I partly mentioned that in the following issue, where I shared concerns regarding our first idea of modifying existing blocks instead of rewriting them from scratch. |
Quick update: I stopped (a while ago) my plans of re-implementing the Checkout block in favor of pushing the "directives hydration" research. I'll continue with the re-implementation later (if we consider it would be worth it). 🙂 |
This issue has been marked as Internal: After 10 days with no activity this issue will be automatically be closed. |
Indeed, this tracking issue is somewhat "stale" as the team is focusing on WordPress/block-interactivity-experiments#64. I don't expect that to change in the coming weeks, possibly months but if plans change we'll keep updating this issue. |
Description
The goal of this project is to test the experiments being done in the Block Hydration Experiments repo (BHE) with some real blocks. And due to the complexity of some of the WooCommerce blocks, we believe it could be a great place to start.
Bear in mind that right now these blocks are already dealing with frontend interactivity and they are working perfectly fine, so don’t expect changes in the UX during this project. It isn’t its goal.
We feel that we can start testing in simpler blocks and work later on more complex ones. These are the initial use cases with client interactivity we are planning to start replicating:
@SantosGuillamot made a quick video to show how they currently work in terms of UX -> Loom video.
Feel free to share any feedback or any other block that you believe could be interesting.
Goals
The goal is to integrate the hydration technique used in Block Hydration Experiments repo into this repo to test it with the Woo blocks.
Based on our initial assessment, using the technique from BHE should allow us to use “wrapperless” hydration based on custom elements which should simplify this logic that handles the hydration of parent and inner blocks.
Out of scope
In this initial phase, we aren’t planning to work on the Product Grid block as it is more complex and will probably require more functionalities we haven’t developed yet. This doesn’t mean we won’t test the experiments there, we will probably do that, but it won’t be part of these first tests.
Tasks / tentative roadmap
These are the steps we defined, although they’re subject to change.
We can start working on:
Rough plan of action
For the very first iteration, I think we should try to hydrate the All Products Block as it does not have any inner blocks:
Enqueue the code that adds our custom
<wp-block>
element to the frontend.In the first iteration, it probably makes sense NOT to add the
<static-context>
to the frontend.Done in Add the
WpBlock
custom element #39.Add the serialization of block attributes and return the blocks wrapped in our custom elements in the
add_data_attributes()
. During SSR, each (hydrated) block should be wrapped with<wp-block>
and pass the attributes to that element instead of the wrapper inadd_data_attributes()
. This step would roughly require substituting the code inadd_data_attributes()
with the one from thebhe_block_wrapper()
.Worked on in All Products block: Try hydrating #21
In the All Products block, update the implementation of the
frontend.js
file to NOT use therenderFrontend()
function but instead register the block in the frontend block registry using (a simplified version of)registerBlockType()
from BHE.Worked on in All Products block: Try hydrating #21
Those steps should (roughly) be sufficient to hydrate a simple block that does not have any inner blocks!
As for hydrating the Cart block or other blocks that include inner blocks, the plan becomes a bit more complex. It would be a good idea to try to first hydrate a single inner block of the Cart block (like the aforementioned Summary Coupon Form). Then, we can progressively expand the set of hydrated inner blocks until all of them are hydrated using the technique from BHE, including the Cart itself.
This would involve (some of) the following steps:
frontend.js
of the Summary Coupon Form to register the block in the frontend block registry using (a simplified version of)registerBlockType()
from BHE. (This is roughly the same step as step 3. for the All Products block).Notes
In BHE, we are automatically deriving the
save
from thefrontend
. For the first iteration, I would NOT include that in our integration so as not to complicate things too much. We can work on this as a later optimization.Questions
The text was updated successfully, but these errors were encountered: