diff --git a/packages/api/rollup.config.js b/packages/api/rollup.config.js index 5351b95f5f..aba28c36a0 100644 --- a/packages/api/rollup.config.js +++ b/packages/api/rollup.config.js @@ -1,6 +1,6 @@ import dts from 'rollup-plugin-dts' import esbuild from 'rollup-plugin-esbuild' -import packageJson from './package.json' assert { type: 'json' }; +import packageJson from './package.json' with { type: 'json' }; import path from 'path'; const name = packageJson.main.replace(/\.js$/, ''); diff --git a/packages/auth/rollup.config.js b/packages/auth/rollup.config.js index ab1343496a..1d4c896bb8 100644 --- a/packages/auth/rollup.config.js +++ b/packages/auth/rollup.config.js @@ -1,7 +1,7 @@ import dts from 'rollup-plugin-dts' import esbuild from 'rollup-plugin-esbuild' import path from 'path'; -import packageJson from './package.json' assert { type: 'json' }; +import packageJson from './package.json' with { type: 'json' }; const name = packageJson.main.replace(/\.js$/, ''); diff --git a/packages/react/rollup.config.js b/packages/react/rollup.config.js index 4eac346993..2e6469b47f 100644 --- a/packages/react/rollup.config.js +++ b/packages/react/rollup.config.js @@ -8,8 +8,8 @@ import bundleSize from 'rollup-plugin-bundle-size'; import { terser } from 'rollup-plugin-terser'; import replace from '@rollup/plugin-replace'; import analyze from 'rollup-plugin-analyzer'; +import packageJson from './package.json' with { type: 'json' }; -const packageJson = require('./package.json'); const PRODUCTION = process.env.NODE_ENV === 'production'; export default [ diff --git a/packages/react/src/views/CommandList/CommandsList.js b/packages/react/src/views/CommandList/CommandsList.js index ad4d9f1d45..642d628dc8 100644 --- a/packages/react/src/views/CommandList/CommandsList.js +++ b/packages/react/src/views/CommandList/CommandsList.js @@ -13,13 +13,32 @@ function CommandsList({ style = {}, messageRef, setFilteredCommands, - filteredCommands, + filteredCommands: propsFilteredCommands, execCommand, commandIndex, setCommandIndex, setShowCommandList, ...props }) { + // Fix for issue #968: Filter out duplicate keyboard shortcut descriptions + // The server returns multiple shortcuts with the same description for message navigation. + // We want to dedup them here to avoid confusing the user. + const filteredCommands = React.useMemo(() => { + if (!propsFilteredCommands) return []; + + const seenDescriptions = new Set(); + return propsFilteredCommands.filter((cmd) => { + // If there's no description or command name, let it through (shouldn't happen for shortcuts) + if (!cmd.description || !cmd.command) return true; + + // Deduplicate by description to avoid confusing the user with multiple keys for the same action + if (seenDescriptions.has(cmd.description)) { + return false; + } + seenDescriptions.add(cmd.description); + return true; + }); + }, [propsFilteredCommands]); const { classNames, styleOverrides } = useComponentOverrides('CommandsList'); const { theme } = useTheme(); const styles = getCommandListStyles(theme);