Skip to content

Commit

Permalink
Edit Site: Remove redundant state in StyleVariationsContainer (WordPr…
Browse files Browse the repository at this point in the history
…ess#66130)

Co-authored-by: tyxla <[email protected]>
Co-authored-by: Mamaduka <[email protected]>
  • Loading branch information
3 people authored Oct 16, 2024
1 parent 0ee8ce4 commit f809836
Showing 1 changed file with 2 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/
import { store as coreStore } from '@wordpress/core-data';
import { useSelect } from '@wordpress/data';
import { useContext, useEffect, useMemo, useState } from '@wordpress/element';
import { useContext, useMemo } from '@wordpress/element';
import { __experimentalGrid as Grid } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
Expand All @@ -20,12 +20,7 @@ const { GlobalStylesContext } = unlock( blockEditorPrivateApis );

export default function StyleVariationsContainer( { gap = 2 } ) {
const { user } = useContext( GlobalStylesContext );
const [ currentUserStyles, setCurrentUserStyles ] = useState( user );
const userStyles = currentUserStyles?.styles;

useEffect( () => {
setCurrentUserStyles( user );
}, [ user ] );
const userStyles = user?.styles;

const variations = useSelect( ( select ) => {
return select(
Expand Down

0 comments on commit f809836

Please sign in to comment.