close
Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Updates per code review.
  • Loading branch information
ryanwelcher committed Dec 8, 2025
commit 0f6b5aac4ddd5d05f9a0b00974fd4acca2dadf13
8 changes: 4 additions & 4 deletions packages/commands/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,8 @@ Attach a command loader to the command palette. Used for dynamic commands.
_Usage_

```js
import { registerPlugin } from '@wordpress/plugins';
import { __ } from '@wordpress/i18n';
import { addQueryArgs } from '@wordpress/url';
import { useCommandLoader } from '@wordpress/commands';
import { page } from '@wordpress/icons';
import { useSelect } from '@wordpress/data';
Expand Down Expand Up @@ -161,16 +162,15 @@ function usePageSearchCommandLoader( { search } ) {
icon: page,
callback: ( { close } ) => {
const args = {
postType,
p: '/page',
postId: record.id,
...extraArgs,
};
document.location = addQueryArgs( 'site-editor.php', args );
close();
},
};
} );
}, [ records, history ] );
}, [ records ] );

return {
commands,
Expand Down
10 changes: 5 additions & 5 deletions packages/commands/src/hooks/use-command-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import { store as commandsStore } from '../store';
*
* @example
* ```js
* import { registerPlugin } from '@wordpress/plugins';
* import { __ } from '@wordpress/i18n';
* import { addQueryArgs } from '@wordpress/url';
* import { useCommandLoader } from '@wordpress/commands';
* import { page } from '@wordpress/icons';
* import { useSelect } from '@wordpress/data';
Expand Down Expand Up @@ -55,16 +56,15 @@ import { store as commandsStore } from '../store';
* icon: page,
* callback: ( { close } ) => {
* const args = {
Comment thread
ryanwelcher marked this conversation as resolved.
* postType,
* postId: record.id,
* ...extraArgs,
* p: '/page',
* postId: record.id,
* };
* document.location = addQueryArgs( 'site-editor.php', args );
* close();
* },
* };
* } );
* }, [ records, history ] );
* }, [ records ] );
*
* return {
* commands,
Expand Down
Loading