From eb036e546af0c848471c6523ce4f7202e9cd88d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dami=C3=A1n=20Su=C3=A1rez?= Date: Mon, 12 Feb 2024 13:24:10 -0300 Subject: [PATCH] rename with updateValue() --- .../block-binding-support/with-block-binding-support.js | 9 ++++++--- packages/editor/src/bindings/entity/index.js | 8 ++++---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/packages/block-editor/src/components/block-binding-support/with-block-binding-support.js b/packages/block-editor/src/components/block-binding-support/with-block-binding-support.js index a3a082d89a0c43..caeab7a49b81b9 100644 --- a/packages/block-editor/src/components/block-binding-support/with-block-binding-support.js +++ b/packages/block-editor/src/components/block-binding-support/with-block-binding-support.js @@ -82,7 +82,10 @@ const withBlockBindingSupport = createHigherOrderComponent( * Pick the prop value and setter * from the source custom hook. */ - const { value, setValue } = useSource( props, settings.args ); + const { value, updateValue } = useSource( + props, + settings.args + ); // Create a unique key for the connector instance const key = `${ settings.source }-${ name }-${ attrName }-${ i }`; @@ -102,9 +105,9 @@ const withBlockBindingSupport = createHigherOrderComponent( attrValue={ attrValue } onAttributeChange={ useCallback( ( newPropValue ) => { - setValue?.( newPropValue ); + updateValue?.( newPropValue ); }, - [ setValue ] + [ updateValue ] ) } /> ); diff --git a/packages/editor/src/bindings/entity/index.js b/packages/editor/src/bindings/entity/index.js index 6fe2666788f37d..919d1c0bc9ed65 100644 --- a/packages/editor/src/bindings/entity/index.js +++ b/packages/editor/src/bindings/entity/index.js @@ -55,21 +55,21 @@ const useSource = ( blockProps, sourceArgs ) => { [ nameFromContext, nameFromArgs ] ); - const [ value, setValue ] = useEntityProp( kind, name, prop, id ); + const [ value, updateValue ] = useEntityProp( kind, name, prop, id ); - function setValueHandler( nextEntityPropValue ) { + function updateValueHandler( nextEntityPropValue ) { // Ensure the value is a string. if ( typeof nextEntityPropValue !== 'string' ) { return; } - setValue( nextEntityPropValue ); + updateValue( nextEntityPropValue ); } return { placeholder: null, value, - setValue: setValueHandler, + updateValue: updateValueHandler, }; };