mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-08 21:52:55 +08:00
🔥 Clean up Styling hooks
This commit is contained in:
parent
b866ac79f6
commit
00519d9e25
1 changed files with 5 additions and 8 deletions
|
@ -7,8 +7,7 @@
|
||||||
* @file
|
* @file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { __, sprintf } from '@wordpress/i18n';
|
import { useCallback } from '@wordpress/element';
|
||||||
import { useCallback } from '@wordpress/element'; // Temporary
|
|
||||||
import { useDispatch, useSelect } from '@wordpress/data';
|
import { useDispatch, useSelect } from '@wordpress/data';
|
||||||
|
|
||||||
import { createHooksForStore } from '../utils';
|
import { createHooksForStore } from '../utils';
|
||||||
|
@ -26,8 +25,6 @@ const useHooks = () => {
|
||||||
const { useTransient } = createHooksForStore( STORE_NAME );
|
const { useTransient } = createHooksForStore( STORE_NAME );
|
||||||
const { persist, setPersistent } = useDispatch( STORE_NAME );
|
const { persist, setPersistent } = useDispatch( STORE_NAME );
|
||||||
|
|
||||||
// Read-only flags and derived state.
|
|
||||||
|
|
||||||
// Transient accessors.
|
// Transient accessors.
|
||||||
const [ isReady ] = useTransient( 'isReady' );
|
const [ isReady ] = useTransient( 'isReady' );
|
||||||
const [ location, setLocation ] = useTransient( 'location' );
|
const [ location, setLocation ] = useTransient( 'location' );
|
||||||
|
@ -39,13 +36,13 @@ const useHooks = () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
const getLocationProp = useCallback(
|
const getLocationProp = useCallback(
|
||||||
( locatonId, prop ) => {
|
( locationId, prop ) => {
|
||||||
if ( undefined === persistentData[ locatonId ]?.[ prop ] ) {
|
if ( undefined === persistentData[ locationId ]?.[ prop ] ) {
|
||||||
console.error(
|
console.error(
|
||||||
`Trying to access non-existent style property: ${ locatonId }.${ prop }. Possibly wrong style name - review the reducer.`
|
`Trying to access non-existent style property: ${ locationId }.${ prop }. Possibly wrong style name - review the reducer.`
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return persistentData[ locatonId ]?.[ prop ];
|
return persistentData[ locationId ]?.[ prop ];
|
||||||
},
|
},
|
||||||
[ persistentData ]
|
[ persistentData ]
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue