chatscope / chatscope/chat-ui-kit-react

msgRef.current is null but got check undefined in the ContentEditable component causing app crashed

Open
#174 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1.8k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

I am facing an error that it'll crash the app entirely. When I traced the error, it shows into this part:
```
if (typeof msgRef.current === "undefined") {
return true;
}
```

![image](https://github.com/user-attachments/assets/d86bbc0f-204c-4921-90ff-d3a4c8f67ee8)

![image](https://github.com/user-attachments/assets/d7cf9193-b70b-40ea-a8e3-7e0d6b1d1e2a)

Based on the error, I think the above line should be checking for null not undefined right. Someone please help, thanks a lot!!

_Originally posted by @tunglamforwork in https://github.com/chatscope/chat-ui-kit-react/discussions/173_

Contributor guide

No contributing guide indexed for this repository

Research direction

Start in the ContentEditable component and inspect the msgRef.current check shown in the issue. Reproduce the reported crash or trace the null-ref path, then verify that the component no longer crashes when the ref is null and that existing behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.