diff --git a/plugins/interactivity-router-2f43f8/src/render.php b/plugins/interactivity-router-2f43f8/src/render.php
index 80cf8ca3..2674dffc 100644
--- a/plugins/interactivity-router-2f43f8/src/render.php
+++ b/plugins/interactivity-router-2f43f8/src/render.php
@@ -16,7 +16,6 @@
data-wp-interactive="router-2f43f8"
data-wp-router-region="region-example-2f43f8"
- data-wp-init="callbacks.setUrlPathname"
>
Displaying region "region-example-2f43f8" from
@@ -40,14 +39,12 @@
-
state.isPlayground:
block (region in display) attributes:
state.urlRegionDisplay:
-
state.urlRegionDisplaySlug:
diff --git a/plugins/interactivity-router-2f43f8/src/view.js b/plugins/interactivity-router-2f43f8/src/view.js
index b2884101..e2c7d396 100644
--- a/plugins/interactivity-router-2f43f8/src/view.js
+++ b/plugins/interactivity-router-2f43f8/src/view.js
@@ -2,32 +2,25 @@ import { store } from '@wordpress/interactivity';
const { state } = store( 'router-2f43f8', {
state: {
- urlPathname: '',
urlRegionDisplay: window.location.href,
get urlRegionDisplaySlug() {
- const isHome = state.urlPathname === '/';
+ const { pathname } = new URL( state.urlRegionDisplay );
+ const isHome = pathname === '/';
return isHome
? '/'
- : '/' + state.urlPathname.split( '/' ).filter( Boolean ).pop();
- },
- get isPlayground() {
- return state.urlPathname.includes( 'scope' );
- },
- },
- callbacks: {
- setUrlPathname: () => {
- state.urlPathname = new URL( state.urlRegionDisplay ).pathname;
+ : '/' + pathname.split( '/' ).filter( Boolean ).pop();
},
},
actions: {
*navigate( e ) {
- console.log( 'navigate', e );
e.preventDefault();
const { actions } = yield import(
'@wordpress/interactivity-router'
);
state.urlRegionDisplay = e.target.href;
- yield actions.navigate( state.urlRegionDisplaySlug );
+
+ //yield actions.navigate( state.urlRegionDisplaySlug );
+ yield actions.navigate( e.target.href );
},
},
} );