Move prop “location” into Redux store

This commit is contained in:
Philipp Stracker 2025-01-16 18:28:11 +01:00
parent 209b7a7c88
commit 0673e5d813
No known key found for this signature in database
2 changed files with 5 additions and 1 deletions

View file

@ -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 };
}; };

View file

@ -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.