-
Notifications
You must be signed in to change notification settings - Fork 11
Support providing Block Context from non-interactive blocks #28
Conversation
f839d1e
to
3a3b9f3
Compare
I've recorded a brief overview of what we've been trying to achieve. If anybody would like to continue this work, you're very welcome to do so! 2022-05-24_16-59-49.mp4 |
Context is not available on save, but why do you need it? If a block provides a context, the value is in one of its attributes. We just need to serialize that value, then add a global event listener. |
Our idea was simply:
But you're right that with the context not being available on
Yup, but I think that would require some modification to the "static" blocks, like adding a wrapper around the |
I don't really care if it's a wrapper or a |
3046a44
to
48c45fa
Compare
We paired up to pair-program on this PR with @luisherranz. We still have to figure out where and how to serialize the data in the static (non-interactive) block: |
I was able to make it work so far in the simplest case: one static (non-interactive) parent and one child interactive block 👍 . Most immediate next steps would be:
|
I made some more progress:
(basically, what I have mentioned in the comment above) I'm sure it's still buggy but seems to work at least in the happy path. 2022-07-06_19-24-35.mp4 |
I'm resolving the conflicts with my refactor on d61391c. |
@michalczaplinski everything should be working again now. Feel free to continue with this 🙂 |
Just to make sure they work fine.
The attributeFilter
approach didn't work. We're going with Michal's initial custom-element proposal.
As the Mutation Observer option could introduce performance concerns and the attributeFilter approach didn't work, I just renamed I've also renamed all the blocks. I hope the new names will help to make more sense of the structure of these experiments for new people looking into them. I've made a video to explain the changes. https://www.loom.com/share/72d45ab8574c42258e8eee48c3dca3d5 @michalczaplinski would you mind taking a look? Thanks!! 🙂 |
I'm going to resolve the conflicts with #41. |
Done 👍️ AFAIK, everything should be ready to merge now. |
63554d4
to
48f88aa
Compare
Looks great, thanks for working on this, @luisherranz ! 🙂 I can't approve my own PR just going to merge it. |
Thanks, Michal! 🎉 |
We have added support for BlockContext in #7.
Interactive blocks can now provide block context to other interactive blocks on the frontend.
However, static (not hydrated) blocks cannot provide context to interactive blocks. This PR is adding support for this feature.