Skip to content

Commit

Permalink
fix: image disappearing with new message (#31215)
Browse files Browse the repository at this point in the history
  • Loading branch information
juliajforesti committed Dec 13, 2023
1 parent 44f3cff commit ac6f68c
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import type { ChannelsImagesProps } from '@rocket.chat/rest-typings';
import { useUserId, useEndpoint } from '@rocket.chat/ui-contexts';
import { useEndpoint } from '@rocket.chat/ui-contexts';
import { useCallback, useEffect, useState } from 'react';

import { useScrollableRecordList } from '../../../hooks/lists/useScrollableRecordList';
import { useStreamUpdatesForMessageList } from '../../../hooks/lists/useStreamUpdatesForMessageList';
import { useComponentDidUpdate } from '../../../hooks/useComponentDidUpdate';
import { ImagesList } from '../../../lib/lists/ImagesList';
import type { MessageList } from '../../../lib/lists/MessageList';

export const useImagesList = (
options: ChannelsImagesProps,
Expand All @@ -18,7 +16,6 @@ export const useImagesList = (
} => {
const [filesList, setFilesList] = useState(() => new ImagesList(options));
const reload = useCallback(() => setFilesList(new ImagesList(options)), [options]);
const uid = useUserId();

useComponentDidUpdate(() => {
options && reload();
Expand Down Expand Up @@ -57,9 +54,6 @@ export const useImagesList = (

const { loadMoreItems, initialItemCount } = useScrollableRecordList(filesList, fetchMessages, 5);

// TODO: chapter day : frontend create useStreamUpdatesForUploadList
useStreamUpdatesForMessageList(filesList as unknown as MessageList, uid, options.roomId || null);

return {
reload,
filesList,
Expand Down

0 comments on commit ac6f68c

Please sign in to comment.