mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-10-18 14:13:21 +00:00
fix crash
This commit is contained in:
parent
28b0ad312b
commit
644c266299
@ -48,6 +48,7 @@ const Note: React.FC<NoteProps> = ({
|
||||
return filter;
|
||||
}, [event.id, showReplies]);
|
||||
const repliesFilterFn = useCallback((e) => getEventReplyingTo(e) === event.id, [event.id]);
|
||||
|
||||
const { events: replies } = useSubscribe({
|
||||
filter: repliesFilter,
|
||||
filterFn: repliesFilterFn,
|
||||
|
@ -32,7 +32,10 @@ const useSubscribe = (ops: SubscribeOptions) => {
|
||||
mergeSubscriptions = defaultOps.mergeSubscriptions,
|
||||
} = ops;
|
||||
|
||||
const shouldReturnEarly = !enabled || filter.limit === 0;
|
||||
|
||||
const getEvents = useCallback(() => {
|
||||
if (shouldReturnEarly) return [];
|
||||
// maybe we should still add filter by displaycount?
|
||||
let e = EventDB.findArray({ ...filter, limit: undefined });
|
||||
if (filterFn) {
|
||||
@ -83,6 +86,10 @@ const useSubscribe = (ops: SubscribeOptions) => {
|
||||
};
|
||||
}, [loadMore]);
|
||||
|
||||
if (shouldReturnEarly) {
|
||||
return { events: [], loadMore: () => {} };
|
||||
}
|
||||
|
||||
return { events, loadMore };
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user