From 127fd58e04ffac7ac6925705a35732bd3f28c699 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:45:44 +0100 Subject: [PATCH 1/4] Get ready for fieldsList on the server --- .vscode/launch.json | 17 +++++++++++++++++ lib/compat/wordpress-6.7/block-bindings.php | 2 ++ .../block-editor/src/hooks/block-bindings.js | 13 +++++++++---- packages/blocks/src/api/registration.js | 14 +++++++++----- 4 files changed, 37 insertions(+), 9 deletions(-) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000000000..a6f85cbc0b3f4 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Listen for XDebug", + "type": "php", + "request": "launch", + "port": 9003, + "pathMappings": { + "/var/www/html/wp-content/plugins/gutenberg": "${workspaceFolder}/" + } + } + ] +} diff --git a/lib/compat/wordpress-6.7/block-bindings.php b/lib/compat/wordpress-6.7/block-bindings.php index 3cecb7fbc0985..2d0f4092f3418 100644 --- a/lib/compat/wordpress-6.7/block-bindings.php +++ b/lib/compat/wordpress-6.7/block-bindings.php @@ -17,6 +17,8 @@ function gutenberg_bootstrap_server_block_bindings_sources() { 'name' => $source->name, 'label' => $source->label, 'usesContext' => $source->uses_context, + // Not sure if we need to update this if we already update Core to use `getFieldsList`. + 'getFieldsList' => $source->get_fields_list, ); } $script = sprintf( 'for ( const source of %s ) { ! wp.blocks.getBlockBindingsSource( source.name ) && wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); diff --git a/packages/block-editor/src/hooks/block-bindings.js b/packages/block-editor/src/hooks/block-bindings.js index e10696cc1257d..d9ede0130a5f0 100644 --- a/packages/block-editor/src/hooks/block-bindings.js +++ b/packages/block-editor/src/hooks/block-bindings.js @@ -229,10 +229,15 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { context[ key ] = blockContext[ key ]; } } - const sourceList = getFieldsList( { - select, - context, - } ); + let sourceList; + if ( typeof getFieldsList === 'function' ) { + sourceList = getFieldsList( { + select, + context, + } ); + } else { + sourceList = { ...getFieldsList }; + } // Only add source if the list is not empty. if ( Object.keys( sourceList || {} ).length ) { _fieldsList[ sourceName ] = { ...sourceList }; diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js index 2f4bab2b5f258..1b4519ead4d72 100644 --- a/packages/blocks/src/api/registration.js +++ b/packages/blocks/src/api/registration.js @@ -811,6 +811,7 @@ export const registerBlockBindingsSource = ( source ) => { * Check if the source has been already registered on the client. * If any property expected to be "client-only" is defined, return a warning. */ + // TODO: Check if server prop getFieldsList has to be included in serverProps. const serverProps = [ 'label', 'usesContext' ]; for ( const prop in existingSource ) { if ( ! serverProps.includes( prop ) && existingSource[ prop ] ) { @@ -892,12 +893,15 @@ export const registerBlockBindingsSource = ( source ) => { warning( 'Block bindings source canUserEditValue must be a function.' ); return; } - // Check the `getFieldsList` property is correct. - if ( getFieldsList && typeof getFieldsList !== 'function' ) { - // eslint-disable-next-line no-console - warning( 'Block bindings source getFieldsList must be a function.' ); - return; + if ( + getFieldsList && + typeof getFieldsList !== 'function' && + typeof getFieldsList !== 'object' + ) { + warning( + 'Block bindings source getFieldsList must be a function or an object.' + ); } return unlock( dispatch( blocksStore ) ).addBlockBindingsSource( source ); From d67ccf7a90ff335d1cf9483056440bfe9edc031a Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Tue, 10 Dec 2024 18:47:59 +0100 Subject: [PATCH 2/4] Not wanted debug config file --- .vscode/launch.json | 17 ----------------- 1 file changed, 17 deletions(-) delete mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index a6f85cbc0b3f4..0000000000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - // Use IntelliSense to learn about possible attributes. - // Hover to view descriptions of existing attributes. - // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 - "version": "0.2.0", - "configurations": [ - { - "name": "Listen for XDebug", - "type": "php", - "request": "launch", - "port": 9003, - "pathMappings": { - "/var/www/html/wp-content/plugins/gutenberg": "${workspaceFolder}/" - } - } - ] -} From 9e0250c61ba3143ae28c88d5f49cc6cccd4c9c09 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Tue, 17 Dec 2024 18:12:21 +0100 Subject: [PATCH 3/4] Rename to fields --- lib/compat/wordpress-6.7/block-bindings.php | 4 ++-- .../block-editor/src/components/rich-text/index.js | 2 +- packages/block-editor/src/hooks/block-bindings.js | 14 +++++++------- packages/blocks/src/api/registration.js | 14 +++++++------- packages/blocks/src/api/test/registration.js | 12 ++++++------ packages/blocks/src/store/private-actions.js | 2 +- packages/blocks/src/store/reducer.js | 8 ++++---- packages/e2e-tests/plugins/block-bindings/index.js | 2 +- packages/editor/src/bindings/post-meta.js | 2 +- .../various/block-bindings/custom-sources.spec.js | 4 ++-- 10 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lib/compat/wordpress-6.7/block-bindings.php b/lib/compat/wordpress-6.7/block-bindings.php index 2d0f4092f3418..e364d19a499ac 100644 --- a/lib/compat/wordpress-6.7/block-bindings.php +++ b/lib/compat/wordpress-6.7/block-bindings.php @@ -17,8 +17,8 @@ function gutenberg_bootstrap_server_block_bindings_sources() { 'name' => $source->name, 'label' => $source->label, 'usesContext' => $source->uses_context, - // Not sure if we need to update this if we already update Core to use `getFieldsList`. - 'getFieldsList' => $source->get_fields_list, + // Not sure if we need to update this if we already update Core to use `fields`. + 'fields' => $source->fields, ); } $script = sprintf( 'for ( const source of %s ) { ! wp.blocks.getBlockBindingsSource( source.name ) && wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index bc8eca6ea94d0..380cbf2651f34 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -203,7 +203,7 @@ export function RichTextWrapper( const { getBlockAttributes } = select( blockEditorStore ); const blockAttributes = getBlockAttributes( clientId ); - const fieldsList = blockBindingsSource?.getFieldsList?.( { + const fieldsList = blockBindingsSource?.fields?.( { select, context: blockBindingsContext, } ); diff --git a/packages/block-editor/src/hooks/block-bindings.js b/packages/block-editor/src/hooks/block-bindings.js index d9ede0130a5f0..eaae7ab5e40d5 100644 --- a/packages/block-editor/src/hooks/block-bindings.js +++ b/packages/block-editor/src/hooks/block-bindings.js @@ -209,9 +209,9 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { const bindableAttributes = getBindableAttributes( blockName ); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); - // `useSelect` is used purposely here to ensure `getFieldsList` + // `useSelect` is used purposely here to ensure `fields` // is updated whenever there are updates in block context. - // `source.getFieldsList` may also call a selector via `select`. + // `source.fields` may also call a selector via `select`. const _fieldsList = {}; const { fieldsList, canUpdateBlockBindings } = useSelect( ( select ) => { @@ -220,8 +220,8 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { } const registeredSources = getBlockBindingsSources(); Object.entries( registeredSources ).forEach( - ( [ sourceName, { getFieldsList, usesContext } ] ) => { - if ( getFieldsList ) { + ( [ sourceName, { fields, usesContext } ] ) => { + if ( fields ) { // Populate context. const context = {}; if ( usesContext?.length ) { @@ -230,13 +230,13 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { } } let sourceList; - if ( typeof getFieldsList === 'function' ) { - sourceList = getFieldsList( { + if ( typeof fields === 'function' ) { + sourceList = fields( { select, context, } ); } else { - sourceList = { ...getFieldsList }; + sourceList = { ...fields }; } // Only add source if the list is not empty. if ( Object.keys( sourceList || {} ).length ) { diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js index 1b4519ead4d72..5d544c8f47157 100644 --- a/packages/blocks/src/api/registration.js +++ b/packages/blocks/src/api/registration.js @@ -800,7 +800,7 @@ export const registerBlockBindingsSource = ( source ) => { getValues, setValues, canUserEditValue, - getFieldsList, + fields, } = source; const existingSource = unlock( @@ -811,7 +811,7 @@ export const registerBlockBindingsSource = ( source ) => { * Check if the source has been already registered on the client. * If any property expected to be "client-only" is defined, return a warning. */ - // TODO: Check if server prop getFieldsList has to be included in serverProps. + // TODO: Check if server prop fields has to be included in serverProps. const serverProps = [ 'label', 'usesContext' ]; for ( const prop in existingSource ) { if ( ! serverProps.includes( prop ) && existingSource[ prop ] ) { @@ -893,14 +893,14 @@ export const registerBlockBindingsSource = ( source ) => { warning( 'Block bindings source canUserEditValue must be a function.' ); return; } - // Check the `getFieldsList` property is correct. + // Check the `fields` property is correct. if ( - getFieldsList && - typeof getFieldsList !== 'function' && - typeof getFieldsList !== 'object' + fields && + typeof fields !== 'function' && + typeof fields !== 'object' ) { warning( - 'Block bindings source getFieldsList must be a function or an object.' + 'Block bindings source fields must be a function or an object.' ); } diff --git a/packages/blocks/src/api/test/registration.js b/packages/blocks/src/api/test/registration.js index 5941415e61fe5..6f6d00cca7d7e 100644 --- a/packages/blocks/src/api/test/registration.js +++ b/packages/blocks/src/api/test/registration.js @@ -1697,15 +1697,15 @@ describe( 'blocks', () => { expect( getBlockBindingsSource( 'core/testing' ) ).toBeUndefined(); } ); - // Check the `getFieldsList` callback is correct. - it( 'should reject invalid getFieldsList callback', () => { + // Check the `fields` callback is correct. + it( 'should reject invalid fields callback', () => { registerBlockBindingsSource( { name: 'core/testing', label: 'testing', - getFieldsList: 'should be a function', + fields: 'should be a function', } ); expect( console ).toHaveWarnedWith( - 'Block bindings source getFieldsList must be a function.' + 'Block bindings source fields must be a function.' ); expect( getBlockBindingsSource( 'core/testing' ) ).toBeUndefined(); } ); @@ -1718,7 +1718,7 @@ describe( 'blocks', () => { getValues: () => 'value', setValues: () => 'new values', canUserEditValue: () => true, - getFieldsList: () => { + fields: () => { return { field: 'value' }; }, }; @@ -1742,7 +1742,7 @@ describe( 'blocks', () => { expect( source.getValues ).toBeUndefined(); expect( source.setValues ).toBeUndefined(); expect( source.canUserEditValue ).toBeUndefined(); - expect( source.getFieldsList ).toBeUndefined(); + expect( source.fields ).toBeUndefined(); unregisterBlockBindingsSource( 'core/valid-source' ); } ); diff --git a/packages/blocks/src/store/private-actions.js b/packages/blocks/src/store/private-actions.js index bfefe56773d77..45c6dbee1038c 100644 --- a/packages/blocks/src/store/private-actions.js +++ b/packages/blocks/src/store/private-actions.js @@ -55,7 +55,7 @@ export function addBlockBindingsSource( source ) { getValues: source.getValues, setValues: source.setValues, canUserEditValue: source.canUserEditValue, - getFieldsList: source.getFieldsList, + fields: source.fields, }; } diff --git a/packages/blocks/src/store/reducer.js b/packages/blocks/src/store/reducer.js index ac652b9189031..bbac230dc05db 100644 --- a/packages/blocks/src/store/reducer.js +++ b/packages/blocks/src/store/reducer.js @@ -394,11 +394,11 @@ export function blockBindingsSources( state = {}, action ) { switch ( action.type ) { case 'ADD_BLOCK_BINDINGS_SOURCE': // Only open this API in Gutenberg and for `core/post-meta` for the moment. - let getFieldsList; + let fields; if ( globalThis.IS_GUTENBERG_PLUGIN ) { - getFieldsList = action.getFieldsList; + fields = action.fields; } else if ( action.name === 'core/post-meta' ) { - getFieldsList = action.getFieldsList; + fields = action.fields; } return { ...state, @@ -413,7 +413,7 @@ export function blockBindingsSources( state = {}, action ) { // Only set `canUserEditValue` if `setValues` is also defined. canUserEditValue: action.setValues && action.canUserEditValue, - getFieldsList, + fields, }, }; case 'REMOVE_BLOCK_BINDINGS_SOURCE': diff --git a/packages/e2e-tests/plugins/block-bindings/index.js b/packages/e2e-tests/plugins/block-bindings/index.js index 5c364257caed1..642b248175fdd 100644 --- a/packages/e2e-tests/plugins/block-bindings/index.js +++ b/packages/e2e-tests/plugins/block-bindings/index.js @@ -22,7 +22,7 @@ registerBlockBindingsSource( { getValues, setValues, canUserEditValue: () => true, - getFieldsList: () => fieldsList, + fields: () => fieldsList, } ); registerBlockBindingsSource( { diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js index fcd068ac21d8a..c76112698b168 100644 --- a/packages/editor/src/bindings/post-meta.js +++ b/packages/editor/src/bindings/post-meta.js @@ -138,7 +138,7 @@ export default { return true; }, - getFieldsList( { select, context } ) { + fields( { select, context } ) { return getPostMetaFields( select, context ); }, }; diff --git a/test/e2e/specs/editor/various/block-bindings/custom-sources.spec.js b/test/e2e/specs/editor/various/block-bindings/custom-sources.spec.js index 033a69e2d6170..f38ab2ff570d8 100644 --- a/test/e2e/specs/editor/various/block-bindings/custom-sources.spec.js +++ b/test/e2e/specs/editor/various/block-bindings/custom-sources.spec.js @@ -763,7 +763,7 @@ test.describe( 'Registered sources', () => { } ); } ); - test.describe( 'getFieldsList', () => { + test.describe( 'fields', () => { test( 'should be possible to update attribute value through bindings UI', async ( { editor, page, @@ -1102,7 +1102,7 @@ test.describe( 'Registered sources', () => { 'Add Empty Field Label' ); } ); - test( 'should show source label when value is empty, cannot edit, and `getFieldsList` is undefined', async ( { + test( 'should show source label when value is empty, cannot edit, and `fields` is undefined', async ( { editor, } ) => { await editor.insertBlock( { From a1112a22a16d6599ada7ec84a5e397903d70bca3 Mon Sep 17 00:00:00 2001 From: Carlos Bravo <37012961+cbravobernal@users.noreply.github.com> Date: Wed, 18 Dec 2024 22:01:04 +0100 Subject: [PATCH 4/4] Use args --- lib/compat/wordpress-6.7/block-bindings.php | 3 +-- .../block-editor/src/components/rich-text/index.js | 2 +- packages/block-editor/src/hooks/block-bindings.js | 14 +++++++------- packages/blocks/src/api/registration.js | 12 +++--------- packages/blocks/src/api/test/registration.js | 12 ++++++------ packages/blocks/src/store/private-actions.js | 2 +- packages/blocks/src/store/reducer.js | 8 ++++---- packages/editor/src/bindings/post-meta.js | 4 +--- 8 files changed, 24 insertions(+), 33 deletions(-) diff --git a/lib/compat/wordpress-6.7/block-bindings.php b/lib/compat/wordpress-6.7/block-bindings.php index e364d19a499ac..4bb7040f188a7 100644 --- a/lib/compat/wordpress-6.7/block-bindings.php +++ b/lib/compat/wordpress-6.7/block-bindings.php @@ -17,8 +17,7 @@ function gutenberg_bootstrap_server_block_bindings_sources() { 'name' => $source->name, 'label' => $source->label, 'usesContext' => $source->uses_context, - // Not sure if we need to update this if we already update Core to use `fields`. - 'fields' => $source->fields, + 'args' => $source->args, ); } $script = sprintf( 'for ( const source of %s ) { ! wp.blocks.getBlockBindingsSource( source.name ) && wp.blocks.registerBlockBindingsSource( source ); }', wp_json_encode( $filtered_sources ) ); diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 380cbf2651f34..373ddddc61362 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -203,7 +203,7 @@ export function RichTextWrapper( const { getBlockAttributes } = select( blockEditorStore ); const blockAttributes = getBlockAttributes( clientId ); - const fieldsList = blockBindingsSource?.fields?.( { + const fieldsList = blockBindingsSource?.args?.( { select, context: blockBindingsContext, } ); diff --git a/packages/block-editor/src/hooks/block-bindings.js b/packages/block-editor/src/hooks/block-bindings.js index eaae7ab5e40d5..0901f7b5bd1b3 100644 --- a/packages/block-editor/src/hooks/block-bindings.js +++ b/packages/block-editor/src/hooks/block-bindings.js @@ -209,9 +209,9 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { const bindableAttributes = getBindableAttributes( blockName ); const dropdownMenuProps = useToolsPanelDropdownMenuProps(); - // `useSelect` is used purposely here to ensure `fields` + // `useSelect` is used purposely here to ensure `args` // is updated whenever there are updates in block context. - // `source.fields` may also call a selector via `select`. + // `source.args` may also call a selector via `select`. const _fieldsList = {}; const { fieldsList, canUpdateBlockBindings } = useSelect( ( select ) => { @@ -220,8 +220,8 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { } const registeredSources = getBlockBindingsSources(); Object.entries( registeredSources ).forEach( - ( [ sourceName, { fields, usesContext } ] ) => { - if ( fields ) { + ( [ sourceName, { args, usesContext } ] ) => { + if ( args ) { // Populate context. const context = {}; if ( usesContext?.length ) { @@ -230,13 +230,13 @@ export const BlockBindingsPanel = ( { name: blockName, metadata } ) => { } } let sourceList; - if ( typeof fields === 'function' ) { - sourceList = fields( { + if ( typeof args === 'function' ) { + sourceList = args( { select, context, } ); } else { - sourceList = { ...fields }; + sourceList = { ...args }; } // Only add source if the list is not empty. if ( Object.keys( sourceList || {} ).length ) { diff --git a/packages/blocks/src/api/registration.js b/packages/blocks/src/api/registration.js index 5d544c8f47157..7e4e01f31d41e 100644 --- a/packages/blocks/src/api/registration.js +++ b/packages/blocks/src/api/registration.js @@ -800,7 +800,7 @@ export const registerBlockBindingsSource = ( source ) => { getValues, setValues, canUserEditValue, - fields, + args, } = source; const existingSource = unlock( @@ -894,14 +894,8 @@ export const registerBlockBindingsSource = ( source ) => { return; } // Check the `fields` property is correct. - if ( - fields && - typeof fields !== 'function' && - typeof fields !== 'object' - ) { - warning( - 'Block bindings source fields must be a function or an object.' - ); + if ( args && typeof args !== 'object' ) { + warning( 'Block bindings source args must be an object.' ); } return unlock( dispatch( blocksStore ) ).addBlockBindingsSource( source ); diff --git a/packages/blocks/src/api/test/registration.js b/packages/blocks/src/api/test/registration.js index 6f6d00cca7d7e..a3ea1badc7819 100644 --- a/packages/blocks/src/api/test/registration.js +++ b/packages/blocks/src/api/test/registration.js @@ -1697,15 +1697,15 @@ describe( 'blocks', () => { expect( getBlockBindingsSource( 'core/testing' ) ).toBeUndefined(); } ); - // Check the `fields` callback is correct. - it( 'should reject invalid fields callback', () => { + // Check the `args` callback is correct. + it( 'should reject invalid args callback', () => { registerBlockBindingsSource( { name: 'core/testing', label: 'testing', - fields: 'should be a function', + args: 'should be a function', } ); expect( console ).toHaveWarnedWith( - 'Block bindings source fields must be a function.' + 'Block bindings source args must be a function.' ); expect( getBlockBindingsSource( 'core/testing' ) ).toBeUndefined(); } ); @@ -1718,7 +1718,7 @@ describe( 'blocks', () => { getValues: () => 'value', setValues: () => 'new values', canUserEditValue: () => true, - fields: () => { + args: () => { return { field: 'value' }; }, }; @@ -1742,7 +1742,7 @@ describe( 'blocks', () => { expect( source.getValues ).toBeUndefined(); expect( source.setValues ).toBeUndefined(); expect( source.canUserEditValue ).toBeUndefined(); - expect( source.fields ).toBeUndefined(); + expect( source.args ).toBeUndefined(); unregisterBlockBindingsSource( 'core/valid-source' ); } ); diff --git a/packages/blocks/src/store/private-actions.js b/packages/blocks/src/store/private-actions.js index 45c6dbee1038c..0f19154676184 100644 --- a/packages/blocks/src/store/private-actions.js +++ b/packages/blocks/src/store/private-actions.js @@ -55,7 +55,7 @@ export function addBlockBindingsSource( source ) { getValues: source.getValues, setValues: source.setValues, canUserEditValue: source.canUserEditValue, - fields: source.fields, + args: source.args, }; } diff --git a/packages/blocks/src/store/reducer.js b/packages/blocks/src/store/reducer.js index bbac230dc05db..6408f31ffaa31 100644 --- a/packages/blocks/src/store/reducer.js +++ b/packages/blocks/src/store/reducer.js @@ -394,11 +394,11 @@ export function blockBindingsSources( state = {}, action ) { switch ( action.type ) { case 'ADD_BLOCK_BINDINGS_SOURCE': // Only open this API in Gutenberg and for `core/post-meta` for the moment. - let fields; + let args; if ( globalThis.IS_GUTENBERG_PLUGIN ) { - fields = action.fields; + args = action.args; } else if ( action.name === 'core/post-meta' ) { - fields = action.fields; + args = action.args; } return { ...state, @@ -413,7 +413,7 @@ export function blockBindingsSources( state = {}, action ) { // Only set `canUserEditValue` if `setValues` is also defined. canUserEditValue: action.setValues && action.canUserEditValue, - fields, + args, }, }; case 'REMOVE_BLOCK_BINDINGS_SOURCE': diff --git a/packages/editor/src/bindings/post-meta.js b/packages/editor/src/bindings/post-meta.js index c76112698b168..c078476cb53c5 100644 --- a/packages/editor/src/bindings/post-meta.js +++ b/packages/editor/src/bindings/post-meta.js @@ -138,7 +138,5 @@ export default { return true; }, - fields( { select, context } ) { - return getPostMetaFields( select, context ); - }, + args: ( { select, context } ) => getPostMetaFields( select, context ), };