Fixing an unwanted page refresh when using Woo Navigation (https://github.com/woocommerce/woocommerce-admin/pull/7615)

* Adding changelog

* Fixing page refresh on woo navigation

* Narrowing scope of navigation slot fills
This commit is contained in:
Joel Thiessen 2021-09-15 09:42:54 -07:00 committed by GitHub
parent 3b3472595e
commit 3ee60dc833
5 changed files with 25 additions and 14 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: Fix
Fixing an unwanted page refresh when using Woo Navigation

View File

@ -174,6 +174,9 @@ class _Layout extends Component {
) }
</div>
<PluginArea scope="woocommerce-admin" />
{ window.wcAdminFeatures.navigation && (
<PluginArea scope="woocommerce-navigation" />
) }
</SlotFillProvider>
);
}

View File

@ -93,4 +93,5 @@ const NavigationPlugin = () => {
registerPlugin( 'wc-admin-navigation', {
render: NavigationPlugin,
scope: 'woocommerce-navigation',
} );

View File

@ -3,13 +3,13 @@
*/
import { __ } from '@wordpress/i18n';
import { Button } from '@wordpress/components';
import { registerPlugin } from "@wordpress/plugins";
import { WooNavigationItem } from "@woocommerce/navigation";
import { registerPlugin } from '@wordpress/plugins';
import { WooNavigationItem } from '@woocommerce/navigation';
const MyPlugin = () => {
const handleClick = () => {
alert( 'Menu item clicked!' );
}
};
return (
<WooNavigationItem item="example-category-child-2">
@ -20,4 +20,7 @@ const MyPlugin = () => {
);
};
registerPlugin('my-plugin', { render: MyPlugin });
registerPlugin( 'my-plugin', {
render: MyPlugin,
scope: 'woocommerce-navigation',
} );

View File

@ -121,5 +121,5 @@ const MyPlugin = () => {
);
};
registerPlugin('my-plugin', { render: MyPlugin });
registerPlugin( 'my-plugin', { render: MyPlugin, scope: 'woocommerce-navigation' } );
```