Skip to content

Commit

Permalink
defer unlock call
Browse files Browse the repository at this point in the history
  • Loading branch information
chad1008 committed Dec 7, 2023
1 parent b84ce30 commit 1ae5a63
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ import { getValueFromVariable } from './utils';
import { setImmutably } from '../../utils/object';
import { unlock } from '../../lock-unlock';

const { Tabs } = unlock( componentsPrivateApis );

export function useHasColorPanel( settings ) {
const hasTextPanel = useHasTextPanel( settings );
const hasBackgroundPanel = useHasBackgroundPanel( settings );
Expand Down Expand Up @@ -207,6 +205,11 @@ function ColorPanelDropdown( {
panelId,
} ) {
const currentTab = tabs.find( ( tab ) => tab.userValue !== undefined );
// Unlocking `Tabs` too early causes the `unlock` method to receive an empty
// object, due to circular dependencies.
// See https://github.com/WordPress/gutenberg/issues/52692
const { Tabs } = unlock( componentsPrivateApis );

return (
<ToolsPanelItem
className="block-editor-tools-panel-color-gradient-settings__item"
Expand Down

0 comments on commit 1ae5a63

Please sign in to comment.