diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-05-03 13:30:50 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-05-03 13:30:50 -0500 |
| commit | 9a7556a9c9b3c1313f11f369d8b38ad8fe144b58 (patch) | |
| tree | b1a113fec3d57d71e1fa71c083e4e25b37e58517 /src | |
| parent | a232848ee4f5539b0041e3581705edd00aec80f0 (diff) | |
| download | slskd-9a7556a9c9b3c1313f11f369d8b38ad8fe144b58.tar.gz | |
don't clear the message if the same room/convo is re-selected
Co-authored-by: Copilot <copilot@github.com>
Diffstat (limited to 'src')
| -rw-r--r-- | src/web/src/components/Chat/Chat.jsx | 6 | ||||
| -rw-r--r-- | src/web/src/components/Rooms/Rooms.jsx | 6 |
2 files changed, 6 insertions, 6 deletions
diff --git a/src/web/src/components/Chat/Chat.jsx b/src/web/src/components/Chat/Chat.jsx index 72960129..086d2cd8 100644 --- a/src/web/src/components/Chat/Chat.jsx +++ b/src/web/src/components/Chat/Chat.jsx @@ -144,11 +144,11 @@ class Chat extends Component { selectConversation = (username) => { this.setState( - { + (previousState) => ({ active: username, loading: true, - message: '', - }, + message: previousState.active === username ? previousState.message : '', + }), async () => { const { active, conversations } = this.state; diff --git a/src/web/src/components/Rooms/Rooms.jsx b/src/web/src/components/Rooms/Rooms.jsx index 0b1366fd..3d29242b 100644 --- a/src/web/src/components/Rooms/Rooms.jsx +++ b/src/web/src/components/Rooms/Rooms.jsx @@ -115,12 +115,12 @@ class Rooms extends Component { selectRoom = async (roomName) => { this.setState( - { + (previousState) => ({ active: roomName, loading: true, - message: '', + message: previousState.active === roomName ? previousState.message : '', room: initialState.room, - }, + }), async () => { const { active } = this.state; |
