From 9db7e547f1d91feb7f0b9ab891703c8fa11f8a9a Mon Sep 17 00:00:00 2001 From: paul sealock Date: Thu, 29 Aug 2024 11:54:30 +1200 Subject: [PATCH] remove jquery-in-react --- plugins/woocommerce-admin/client/settings/index.js | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/plugins/woocommerce-admin/client/settings/index.js b/plugins/woocommerce-admin/client/settings/index.js index efa3d2e7007..eb0e6e12f36 100644 --- a/plugins/woocommerce-admin/client/settings/index.js +++ b/plugins/woocommerce-admin/client/settings/index.js @@ -45,8 +45,17 @@ const Settings = ( { params } ) => { sidebarVisisble ); - const event = new Event( 'reactRendered' ); - window.dispatchEvent( event ); + // Append a new script tag + const script = document.createElement( 'script' ); + script.src = + 'http://localhost:8888/wp-content/plugins/woocommerce/assets/js/admin/wc-shipping-classes.js'; + script.async = true; + document.body.appendChild( script ); + + // Cleanup function to remove the script when the component unmounts + return () => { + document.body.removeChild( script ); + }; }, [ params.page, section, sidebarVisisble ] ); // Register the slot fills for the settings page just once.