Skip to content

Commit

Permalink
Remove unneeded changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ellatrix committed Nov 14, 2024
1 parent 7fb5854 commit e55d065
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions packages/interface/src/components/complementary-area/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,6 @@ function ComplementaryArea( {
isActive,
isSmall
);
const { getActiveComplementaryArea } = useSelect( interfaceStore );
const {
enableComplementaryArea,
disableComplementaryArea,
Expand All @@ -242,24 +241,22 @@ function ComplementaryArea( {
} = useDispatch( interfaceStore );

useEffect( () => {
// Make sure we have the latest active area.
const freshActiveArea = getActiveComplementaryArea( scope );
// Set initial visibility: For large screens, enable if it's active by
// default. For small screens, always initially disable.
if ( isActiveByDefault && freshActiveArea === undefined && ! isSmall ) {
if ( isActiveByDefault && activeArea === undefined && ! isSmall ) {
enableComplementaryArea( scope, identifier );
} else if ( freshActiveArea === undefined && isSmall ) {
} else if ( activeArea === undefined && isSmall ) {
disableComplementaryArea( scope, identifier );
}
setIsReady( true );
}, [
activeArea,
isActiveByDefault,
scope,
identifier,
isSmall,
enableComplementaryArea,
disableComplementaryArea,
getActiveComplementaryArea,
] );

if ( ! isReady ) {
Expand Down

0 comments on commit e55d065

Please sign in to comment.