Skip to content

Commit

Permalink
Feedback suggestions from review:
Browse files Browse the repository at this point in the history
add overrides to dep array in Editor Styles
rename hook
  • Loading branch information
ramonjd committed Jun 25, 2024
1 parent f1c92dc commit fab458f
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ function EditorStyles( { styles, scope, overrides } ) {
.map( ( style ) => style.assets )
.join( '' ),
];
}, [ styles, styleOverrides, scope ] );
}, [ styles, styleOverrides, overrides, scope ] );

return (
<>
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/block-style-variation.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ function getVariationNameFromClass( className, registeredStyles = [] ) {
* @param {Object} config A global styles object, containing settings and styles.
* @return {Array} An array of new block variation overrides.
*/
export function useUpdateBlockVariationOverridesWithConfig( config ) {
export function useUpdateBlockStyleVariationOverridesWithConfig( config ) {
const overrides = useSelect(
( select ) => unlock( select( blockEditorStore ) ).getStyleOverrides(),
[]
Expand Down
2 changes: 1 addition & 1 deletion packages/block-editor/src/hooks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,4 @@ export { getTypographyClassesAndStyles } from './use-typography-props';
export { getGapCSSValue } from './gap';
export { useCachedTruthy } from './use-cached-truthy';
export { useZoomOut } from './use-zoom-out';
export { useUpdateBlockVariationOverridesWithConfig } from './block-style-variation';
export { useUpdateBlockStyleVariationOverridesWithConfig } from './block-style-variation';
4 changes: 2 additions & 2 deletions packages/block-editor/src/private-apis.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { BlockRemovalWarningModal } from './components/block-removal-warning-mod
import {
useLayoutClasses,
useLayoutStyles,
useUpdateBlockVariationOverridesWithConfig,
useUpdateBlockStyleVariationOverridesWithConfig,
} from './hooks';
import DimensionsTool from './components/dimensions-tool';
import ResolutionTool from './components/resolution-tool';
Expand Down Expand Up @@ -92,5 +92,5 @@ lock( privateApis, {
PrivatePublishDateTimePicker,
useSpacingSizes,
useBlockDisplayTitle,
useUpdateBlockVariationOverridesWithConfig,
useUpdateBlockStyleVariationOverridesWithConfig,
} );
4 changes: 2 additions & 2 deletions packages/edit-site/src/components/revisions/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const {
ExperimentalBlockEditorProvider,
GlobalStylesContext,
useGlobalStylesOutputWithConfig,
useUpdateBlockVariationOverridesWithConfig,
useUpdateBlockStyleVariationOverridesWithConfig,
} = unlock( blockEditorPrivateApis );
const { mergeBaseAndUserConfigs } = unlock( editorPrivateApis );

Expand All @@ -35,7 +35,7 @@ function isObjectEmpty( object ) {

function RevisionStyles( { styles, config } ) {
const mergedOverrides =
useUpdateBlockVariationOverridesWithConfig( config );
useUpdateBlockStyleVariationOverridesWithConfig( config );

return <EditorStyles styles={ styles } overrides={ mergedOverrides } />;
}
Expand Down

0 comments on commit fab458f

Please sign in to comment.