Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
Rocket.Chat
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Package Registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
RocketChat
Rocket.Chat
Commits
6bce20a3
Unverified
Commit
6bce20a3
authored
1 year ago
by
Guilherme Gazzo
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
fix: Message sent triggering thread subscriptions multiple times (#29546)
parent
c43b745f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.changeset/tricky-tomatoes-sit.md
+5
-0
5 additions, 0 deletions
.changeset/tricky-tomatoes-sit.md
apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMainMessageQuery.ts
+13
-12
13 additions, 12 deletions
.../contextualBar/Threads/hooks/useThreadMainMessageQuery.ts
with
18 additions
and
12 deletions
.changeset/tricky-tomatoes-sit.md
0 → 100644
+
5
−
0
View file @
6bce20a3
---
'
@rocket.chat/meteor'
:
minor
---
fix: Message sent triggering thread subscriptions multiple times
This diff is collapsed.
Click to expand it.
apps/meteor/client/views/room/contextualBar/Threads/hooks/useThreadMainMessageQuery.ts
+
13
−
12
View file @
6bce20a3
...
...
@@ -82,8 +82,9 @@ export const useThreadMainMessageQuery = (
useEffect
(()
=>
{
return
()
=>
{
unsubscribeRef
.
current
?.();
unsubscribeRef
.
current
=
undefined
;
};
},
[]);
},
[
tmid
]);
return
useQuery
(
[
'
rooms
'
,
room
.
_id
,
'
threads
'
,
tmid
,
'
main-message
'
]
as const
,
...
...
@@ -96,17 +97,17 @@ export const useThreadMainMessageQuery = (
throw
new
Error
(
'
Invalid main message
'
);
}
unsubscribeRef
.
current
?.();
unsubscribeRef
.
current
=
subscribeToMessage
(
mainMessage
,
{
onMutate
:
()
=>
{
queryClient
.
invalidateQueries
(
queryKey
,
{
exact
:
true
});
},
onDelete
:
()
=>
{
onDelete
?.();
queryClient
.
invalidateQueries
(
queryKey
,
{
exact
:
true
});
},
});
unsubscribeRef
.
current
=
unsubscribeRef
.
current
||
subscribeToMessage
(
mainMessage
,
{
onMutate
:
()
=>
{
queryClient
.
invalidateQueries
(
queryKey
,
{
exact
:
true
});
},
onDelete
:
()
=>
{
onDelete
?.();
queryClient
.
invalidateQueries
(
queryKey
,
{
exact
:
true
});
},
});
return
mainMessage
;
},
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment