️ Resolve unnecessary re-render of header

This commit is contained in:
Philipp Stracker 2025-01-27 15:30:21 +01:00
parent 023bc277d0
commit 9c1803e8ea
No known key found for this signature in database
2 changed files with 7 additions and 8 deletions

View file

@ -1,3 +1,5 @@
import { useCallback } from '@wordpress/element';
import {
CommonHooks,
PaymentHooks,
@ -12,7 +14,7 @@ export const useSaveSettings = () => {
const { persist: persistSettings } = SettingsHooks.useStore();
const { persist: persistStyling } = StylingHooks.useStore();
const persistAll = () => {
const persistAll = useCallback( () => {
withActivity(
'persist-methods',
'Save payment methods',
@ -28,7 +30,7 @@ export const useSaveSettings = () => {
'Save styling details',
persistStyling
);
};
}, [ persistPayment, persistSettings, persistStyling, withActivity ] );
return { persistAll };
};