Skip to content
This repository has been archived by the owner on Jun 7, 2022. It is now read-only.

Fixing an unwanted page refresh when using Woo Navigation #7615

Merged
merged 3 commits into from Sep 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelogs/fix-woonav-page-refresh
@@ -0,0 +1,4 @@
Significance: patch
Type: Fix

Fixing an unwanted page refresh when using Woo Navigation
3 changes: 3 additions & 0 deletions client/layout/index.js
Expand Up @@ -174,6 +174,9 @@ class _Layout extends Component {
) }
</div>
<PluginArea scope="woocommerce-admin" />
{ window.wcAdminFeatures.navigation && (
<PluginArea scope="woocommerce-navigation" />
) }
</SlotFillProvider>
);
}
Expand Down
1 change: 1 addition & 0 deletions client/layout/navigation.js
Expand Up @@ -93,4 +93,5 @@ const NavigationPlugin = () => {

registerPlugin( 'wc-admin-navigation', {
render: NavigationPlugin,
scope: 'woocommerce-navigation',
} );
29 changes: 16 additions & 13 deletions docs/examples/extensions/add-navigation-items/js/index.js
Expand Up @@ -3,21 +3,24 @@
*/
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!' );
}
const handleClick = () => {
alert( 'Menu item clicked!' );
};

return (
<WooNavigationItem item="example-category-child-2">
<Button onClick={ handleClick }>
{ __( 'JavaScript Example', 'plugin-domain' ) }
</Button>
</WooNavigationItem>
);
return (
<WooNavigationItem item="example-category-child-2">
<Button onClick={ handleClick }>
{ __( 'JavaScript Example', 'plugin-domain' ) }
</Button>
</WooNavigationItem>
);
};

registerPlugin('my-plugin', { render: MyPlugin });
registerPlugin( 'my-plugin', {
render: MyPlugin,
scope: 'woocommerce-navigation',
} );
2 changes: 1 addition & 1 deletion docs/features/navigation.md
Expand Up @@ -121,5 +121,5 @@ const MyPlugin = () => {
);
};

registerPlugin('my-plugin', { render: MyPlugin });
registerPlugin( 'my-plugin', { render: MyPlugin, scope: 'woocommerce-navigation' } );
```