handle query omission

This commit is contained in:
paul sealock 2024-09-04 14:07:08 +12:00
parent 802d8b853c
commit ee7f1935c4
3 changed files with 5 additions and 3 deletions

View File

@ -56,7 +56,6 @@ const removeSettingsScripts = ( scripts ) => {
}; };
const Settings = ( { params } ) => { const Settings = ( { params } ) => {
console.log( params );
useFullScreen( [ 'woocommerce-settings' ] ); useFullScreen( [ 'woocommerce-settings' ] );
const settingsData = window.wcSettings?.admin?.settingsPages; const settingsData = window.wcSettings?.admin?.settingsPages;
const sections = settingsData[ params.page ]?.sections; const sections = settingsData[ params.page ]?.sections;

View File

@ -7,7 +7,9 @@ import { getNewPath, navigateTo } from '@woocommerce/navigation';
export const Tabs = ( { data, page, children } ) => { export const Tabs = ( { data, page, children } ) => {
const onSelect = ( tabName ) => { const onSelect = ( tabName ) => {
const url = getNewPath( {}, `/settings/${ tabName }`, {} ); const url = getNewPath( {}, `/settings/${ tabName }`, {} );
navigateTo( { url } ); if ( page !== tabName ) {
navigateTo( { url } );
}
}; };
return ( return (
@ -22,6 +24,7 @@ export const Tabs = ( { data, page, children } ) => {
name: key, name: key,
title: data[ key ].label, title: data[ key ].label,
} ) ) } } ) ) }
selectOnMove={ false }
> >
{ () => <div>{ children }</div> } { () => <div>{ children }</div> }
</TabPanel> </TabPanel>

View File

@ -173,7 +173,7 @@ if ( ! class_exists( 'WC_Settings_Page', false ) ) :
$tags = new WP_HTML_Tag_Processor( $html ); $tags = new WP_HTML_Tag_Processor( $html );
while( $tags->next_tag( array( 'tag_name' => 'script' ) ) ) { while( $tags->next_tag( array( 'tag_name' => 'script' ) ) ) {
$script_type = $tags->get_attribute( 'type' ); $script_type = $tags->get_attribute( 'type' );
if ( 'text/html' !== $script_type ) { if ( 'text/javascript' === $script_type ) {
$script_contents = $tags->get_modifiable_text(); $script_contents = $tags->get_modifiable_text();
$section_settings_data[] = array( $section_settings_data[] = array(
'type' => 'script', 'type' => 'script',