RocketChat / RocketChat/Rocket.Chat

chore: Replace non-null assertions with proper error handling in RealAppsEngineUIHost

Open
#38,754 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: feature
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 username in getClientRoomInfo
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 undefined or null values.
  • Remove the // FIXME comment.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.