Skip to content

Commit

Permalink
regression: fix error observe (#34222)
Browse files Browse the repository at this point in the history
  • Loading branch information
ggazzo authored and MartinSchoeler committed Dec 30, 2024
1 parent 2990de5 commit 12ce9c6
Showing 1 changed file with 7 additions and 14 deletions.
21 changes: 7 additions & 14 deletions apps/meteor/client/providers/OmnichannelProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const OmnichannelProvider = ({ children }: OmnichannelProviderProps) => {
OmnichannelSortingMechanismSettingType.Timestamp,
);

const lastQueueSize = useRef(0);

const loggerRef = useRef(new ClientLogger('OmnichannelProvider'));
const hasAccess = usePermission('view-l-room');
const canViewOmnichannelQueue = usePermission('view-livechat-queue');
Expand Down Expand Up @@ -151,20 +153,11 @@ const OmnichannelProvider = ({ children }: OmnichannelProviderProps) => {
);

useEffect(() => {
const observer = LivechatInquiry.find(
{ status: LivechatInquiryStatus.QUEUED },
{
sort: getOmniChatSortQuery(omnichannelSortingMechanism),
limit: omnichannelPoolMaxIncoming,
},
).observe({
added: (_inquiry) => {
KonchatNotification.newRoom();
},
});

return () => observer.stop();
}, [omnichannelPoolMaxIncoming, omnichannelSortingMechanism]);
if (lastQueueSize.current < (queue?.length ?? 0)) {
KonchatNotification.newRoom();
}
lastQueueSize.current = queue?.length ?? 0;
}, [queue?.length]);

useOmnichannelContinuousSoundNotification(queue ?? []);

Expand Down

0 comments on commit 12ce9c6

Please sign in to comment.