RocketChat / RocketChat/Rocket.Chat
chore: Replace non-null assertions with proper error handling in RealAppsEngineUIHost
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
The file client/apps/RealAppsEngineUIHost.ts currently contains multiple non-null assertions (!) that are marked with a // FIXME comment. These assertions are unsafe and bypass strict null checks, which can lead to potential runtime errors if the expected data is missing.
Current Behavior
The code uses ! to force non-null types for:
- getUserAvatarURL(username)
room.name/slugifiedName- getUser() result
- Member
usernameingetClientRoomInfo
Expected Behavior
The non-null assertions should be replaced with proper null checks and error handling. If a required value is missing (e.g., user not logged in, room name undefined), the code should handle it gracefully or throw a meaningful error instead of risking a crash.
Tasks
- Locate RealAppsEngineUIHost.ts in
client/apps/. - Remove all
!non-null assertions. - Implement explicit checks for
undefinedornullvalues. - Remove the
// FIXMEcomment.
Contributor guide
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 by reading client/apps/RealAppsEngineUIHost.ts and the referenced getUserAvatarURL, getUser, room, and getClientRoomInfo call sites. Identify how missing users, room names, avatar URLs, and member usernames are represented before choosing explicit handling. Done means all listed non-null assertions and the FIXME comment are removed and missing values are handled explicitly.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100