-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Experiment: "Live block" using the latest-comments block #38843
base: trunk
Are you sure you want to change the base?
Conversation
Size Change: +229 B (0%) Total Size: 1.15 MB
ℹ️ View Unchanged
|
I'm so glad you are exploring this approach. It made me realize that the To give an example let's use the Comment Content block. It reads the comment id from the block context:
gutenberg/packages/block-library/src/comment-content/index.php Lines 16 to 19 in b22ce95
I checked the existing core blocks that use the gutenberg/packages/block-library/src/calendar/edit.js Lines 89 to 92 in b22ce95
gutenberg/packages/block-library/src/calendar/index.php Lines 27 to 41 in b22ce95
|
This is an experiment in "server components" pattern. It's related to the #38713 as this PR is using the same pattern of data loading +
morphdom
.Here, I have created a new block called
latest-comments-filter
which dynamically loads the HTML for thelatest-comments
block from the props passed to theblock-renderer
endpoint. It then usesmorphdom
to update thelatest-comments
block's DOM with new HTML.Some video demos (there is some vague speculation at the end of the first video, sorry for that 😅)
2022-02-15_19-22-27.mp4
I've forgotten to mention some additional stuff so short part 2:
2022-02-15_19-42-23.mp4