-
Notifications
You must be signed in to change notification settings - Fork 43
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
Work with client side navigation disabled #15
Conversation
- Update to the latest version of the library - Add the missing code that adds wp-island
- Update to the latest version of the library - Add the missing code that adds wp-island
I've tested the UX, and it looks great! 🙂 A couple of comments:
|
"style": "file:./style-index.css" | ||
"style": "file:./style-index.css", | ||
"supports": { | ||
"interactivity": true |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need this to make the block interactive? If so, why? I thought this property wasn't needed anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have to add this property so that the wp_directives_mark_interactive_blocks function can add the wp-island
to the interactive blocks.
Alternatively, the user can add the wp-island
attribute manually in the render.php
function but I think we should encourage adding this in the block.json
.
There is a discussion around 1) detecting the interactive (using directives) blocks automatically in:
But we haven't settled on a definite solution yet as far as I can see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, I forgot about that 😅 . Hopefully, we can remove it in the future once that is done automatically.
You're right! This would be a better UX. Either that, or we should add the debouncing when the client-side navigations are disabled. I will try adding a "search" button next to the input only when the client-side navigations are disabled.
Yeah, that's a really good idea! I'll add this in a separate PR. I will first try to move the demo to https://github.com/WordPress/block-hydration-experiments so that I can use the latest code for the server-side |
bc1ed8e
to
9a090bb
Compare
I've realized that to make this work in the most idiomatic way possible, I need to change the behaviour of I can easily get this setting on the server using sth like: $settings = get_option( 'wp_directives_plugin_settings' );
if ( $settings['client_side_navigation'] ) {
// navigations are enabled
} But if I want to get this setting on the client in the The most idiomatic way to do it is gonna be to to save the value of I ll implement this feature once I've moved the demo to https://github.com/WordPress/block-hydration-experiments. I'm now going to only merge the changes to the README in this PR. The rest of the changes in this PR were just pulling the latest updates from BHE and adding |
Actually, instead of figuring out which commits to undo, I ll just close this PR and add the README updates when I open the PR against BHE. That'll have to wait till tomorrow though :) |
We need to investigate if we want to expose some parts of the router in the store, like: {
state: {
router: {
url: "https://mysite.com/post",
}
},
actions: {
router: {
navigate: async (url) => {
// ...
}
}
}
} That would be the perfect place for a flag like that. @michalczaplinski, would you mind adding it to the decisions that need to be made? Thanks!! 🙂 |
Sure thing! I've added this as an item under State management in the BHE Tracking Issue. Should we mention it anywhere else? |
Maybe we should open an issue? |
This PR makes the demo work with the client side navigations disabled.
The missing bit was to include the missing
wp_directives_mark_interactive_blocks
function.I also took this opportunity to:
client-side-transitions.php
file and move the code intoinit.php
runtime
to the latest version from the block-hydration-experiments