i’m using amity on mobile and web projects, the mobile is getting and updating the component, but on admin this its not happening, the code are basically the same on both sides. some thoughts? already tried using the method observeMessages but not working too. there is some other way to make livemessages?
useEffect(() => {
if (isClientInitialized) {
const unsubscriber = ChannelRepository.getChannels(
{
limit: 100,
...getTagFilter(),
types: [CHANNEL_TYPE],
isDeleted: false,
},
({ data: channelsData, onNextPage, hasNextPage, loading }) => {
setState((prev) => ({
...prev,
loading,
channels: _.uniqBy(
[...prev.channels, ...(channelsData || [])],
"_id"
),
hasNextPageChannels: hasNextPage,
onNextPageChannels: onNextPage,
}));
}
);
return () => unsubscriber();
}
}, [isClientInitialized]);
useEffect(() => {
if (selectedChannel) {
setState((prev) => ({
...prev,
loadingMessages: true,
}));
let isSubscribed = true;
SubChannelRepository.startMessageReceiptSync(selectedChannel._id);
unsubscriberMessages = MessageRepository.getMessages(
{
subChannelId: selectedChannel._id,
limit: 100,
},
({ data: messagesData, onNextPage, hasNextPage, loading, error }) => {
if (!isSubscribed) return;
setState((prev) => ({ ...prev, loadingMessages: loading }));
if (messagesData) {
const newMessages = new Map();
messagesData.forEach((message) => {
newMessages.set(message.messageId, message);
});
setState((prev) => ({
...prev,
messages: newMessages,
hasNextPageMessages: hasNextPage,
onNextPageMessages: onNextPage,
}));
}
}
);
}
}, [selectedChannel?.channelId]);