mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-06 14:57:26 +08:00
✨ Move prop “location” into Redux store
This commit is contained in:
parent
209b7a7c88
commit
0673e5d813
2 changed files with 5 additions and 1 deletions
|
@ -30,6 +30,7 @@ const useHooks = () => {
|
||||||
|
|
||||||
// Transient accessors.
|
// Transient accessors.
|
||||||
const [ isReady ] = useTransient( 'isReady' );
|
const [ isReady ] = useTransient( 'isReady' );
|
||||||
|
const [ location, setLocation ] = useTransient( 'location' );
|
||||||
|
|
||||||
// Persistent accessors.
|
// Persistent accessors.
|
||||||
const [ shape, setShape ] = usePersistent( 'shape' );
|
const [ shape, setShape ] = usePersistent( 'shape' );
|
||||||
|
@ -37,6 +38,8 @@ const useHooks = () => {
|
||||||
return {
|
return {
|
||||||
persist,
|
persist,
|
||||||
isReady,
|
isReady,
|
||||||
|
location,
|
||||||
|
setLocation,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +49,7 @@ export const useStore = () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const useStylingLocation = () => {
|
export const useStylingLocation = () => {
|
||||||
const [ location, setLocation ] = useState( 'cart' );
|
const { location, setLocation } = useHooks();
|
||||||
return { location, setLocation };
|
return { location, setLocation };
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ import { STYLING_COLORS, STYLING_SHAPES } from './configuration';
|
||||||
// Transient: Values that are _not_ saved to the DB (like app lifecycle-flags).
|
// Transient: Values that are _not_ saved to the DB (like app lifecycle-flags).
|
||||||
const defaultTransient = Object.freeze( {
|
const defaultTransient = Object.freeze( {
|
||||||
isReady: false,
|
isReady: false,
|
||||||
|
location: 'cart', // Which location is selected in the Styling tab.
|
||||||
} );
|
} );
|
||||||
|
|
||||||
// Persistent: Values that are loaded from the DB.
|
// Persistent: Values that are loaded from the DB.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue