mirror of
https://github.com/getpaseo/paseo.git
synced 2026-07-29 12:01:31 +00:00
Fix duplicate /clear in the slash command menu
A client command and a provider command can share a name (e.g. clear). Both produced the same option id, which became a duplicate React key — React then left stale rows and scrambled ordering, so /clear showed twice and ranking broke as the query narrowed. Drop the colliding provider command and keep the client one, which has extra affordances.
This commit is contained in:
@@ -318,13 +318,14 @@ export function useAgentAutocomplete(input: UseAgentAutocompleteInput): AgentAut
|
||||
const providerCommands = commands.map(
|
||||
(command): AvailableCommand => ({ source: "provider", command }),
|
||||
);
|
||||
const clientCommandNames = new Set(CLIENT_SLASH_COMMANDS.map((command) => command.name));
|
||||
const availableCommands: AvailableCommand[] = isDraftContext
|
||||
? providerCommands
|
||||
: [
|
||||
...CLIENT_SLASH_COMMANDS.map(
|
||||
(command): AvailableCommand => ({ source: "client", command }),
|
||||
),
|
||||
...providerCommands,
|
||||
...providerCommands.filter((entry) => !clientCommandNames.has(entry.command.name)),
|
||||
];
|
||||
const matches = filterAndRankCommandAutocompleteEntries(
|
||||
availableCommands,
|
||||
|
||||
Reference in New Issue
Block a user