Skip to content

Commit

Permalink
useNestedSettingsUpdate: prevent unneeded syncing of falsy templateLo…
Browse files Browse the repository at this point in the history
…ck values
  • Loading branch information
jsnajdr committed Dec 7, 2022
1 parent d5dcbd1 commit edefaac
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,16 @@ export default function useNestedSettingsUpdate(

const { blockListSettings, parentLock } = useSelect(
( select ) => {
const rootClientId =
select( blockEditorStore ).getBlockRootClientId( clientId );
const {
getBlockRootClientId,
getBlockListSettings,
getTemplateLock,
} = select( blockEditorStore );

const rootClientId = getBlockRootClientId( clientId );
return {
blockListSettings:
select( blockEditorStore ).getBlockListSettings( clientId ),
parentLock:
select( blockEditorStore ).getTemplateLock( rootClientId ),
blockListSettings: getBlockListSettings( clientId ),
parentLock: getTemplateLock( rootClientId ) ?? false,
};
},
[ clientId ]
Expand Down

0 comments on commit edefaac

Please sign in to comment.