From c636509579bbd42867aad05695302aba043cb7b7 Mon Sep 17 00:00:00 2001 From: Alquen Sarmiento Date: Fri, 2 May 2025 13:04:57 +0800 Subject: [PATCH] fix: ensure that the props are not being edited --- src/welcome/admin.js | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/src/welcome/admin.js b/src/welcome/admin.js index f61e9754db..724059e97a 100644 --- a/src/welcome/admin.js +++ b/src/welcome/admin.js @@ -1171,8 +1171,11 @@ const GlobalSettings = props => { const RoleManager = props => { const groups = props.filteredSearchTree.find( tab => tab.id === 'role-manager' ).groups - props.roleManager = groups.find( group => group.id === 'role-manager' ) const groupLength = groups.reduce( ( acc, curr ) => acc + curr.children.length, 0 ) + const propsToPass = { + ...props, + roleManager: groups.find( group => group.id === 'role-manager' ), + } const EditorModeSettings = applyFilters( 'stackable.admin.settings.editorModeSettings', Fragment ) @@ -1182,7 +1185,7 @@ const RoleManager = props => {

{ __( 'No matching settings', i18n ) }

) : ( <> - { props.roleManager.children.length > 0 && + { propsToPass.roleManager.children.length > 0 &&

{ __( 'Role Manager', i18n ) }

@@ -1200,7 +1203,7 @@ const RoleManager = props => { { isPro ? }>

- +
:

@@ -1220,8 +1223,11 @@ const RoleManager = props => { const CustomFields = props => { const groups = props.filteredSearchTree.find( tab => tab.id === 'custom-fields-settings' ).groups - props.customFields = groups.find( group => group.id === 'custom-fields-settings' ) const groupLength = groups.reduce( ( acc, curr ) => acc + curr.children.length, 0 ) + const propsToPass = { + ...props, + customFields: groups.find( group => group.id === 'custom-fields-settings' ), + } const CustomFieldsEnableSettings = applyFilters( 'stackable.admin.settings.customFieldsEnableSettings', Fragment ) const CustomFieldsManagerSettings = applyFilters( 'stackable.admin.settings.customFieldsManagerSettings', Fragment ) @@ -1232,14 +1238,14 @@ const CustomFields = props => {

{ __( 'No matching settings', i18n ) }

) : ( <> - { props.customFields.children.length > 0 && + { propsToPass.customFields.children.length > 0 &&

{ __( 'Custom Fields', i18n ) }

{ isPro && }>
- +
} @@ -1253,7 +1259,7 @@ const CustomFields = props => { { isPro ? }>
- +
:

@@ -1279,8 +1285,11 @@ const Integrations = props => { } = props const groups = filteredSearchTree.find( tab => tab.id === 'integrations' ).groups - props.integrations = groups.find( group => group.id === 'integrations' ) const groupLength = groups.reduce( ( acc, curr ) => acc + curr.children.length, 0 ) + const propsToPass = { + ...props, + integrations: groups.find( group => group.id === 'integrations' ), + } const IconSettings = applyFilters( 'stackable.admin.settings.iconSettings', Fragment ) @@ -1290,13 +1299,13 @@ const Integrations = props => {

{ __( 'No matching settings', i18n ) }

) : ( <> - { props.integrations.children.length > 0 && + { propsToPass.integrations.children.length > 0 &&

{ __( 'Integrations', i18n ) }

{ __( 'Here are settings for the different integrations available in Stackable.', i18n ) }

{ @@ -1316,7 +1325,7 @@ const Integrations = props => { { isPro ? }>
- +
: <> @@ -1347,7 +1356,7 @@ const Integrations = props => {