RocketChat / RocketChat/EmbeddedChat
Bug : Crash when typing unknown slash command (e.g., /hello)
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 165
- Forks
- 381
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 1
Description
This PR fixes a crash that occurs when a user types an unknown slash command (e.g., /hello) and presses Enter.
Previously, entering a slash command that does not exist in the client-side commands list caused the application to crash with a TypeError. This PR ensures that the client handles unknown slash commands gracefully and aligns behavior with standard Rocket.Chat expectations.
Steps to Reproduce
- Open EmbeddedChat.
- Type
/hello(or any unknown slash command) in the chat input. - Press Enter.
Observed Behavior
The application crashes with the following error:
Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'command')
at CommandsList.js:33
at HTMLDocument.handleKeyPress (CommandsList.js:54)
Expected Behavior
- The message
/helloshould be sent to the server. - The server should respond with
No such command: /hello(standard Rocket.Chat behavior). - At a minimum, the client should not crash.
- Add a defensive check to ensure
selectedItemexists before accessing its properties.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in CommandsList.js, especially the keypress handling at the reported lines, and reproduce the issue by entering /hello and pressing Enter. Done means unknown commands no longer cause a TypeError, the message is sent for server handling, and the client remains usable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, react
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100