fix: fix some case(maybe) can not key problem

This commit is contained in:
moonrailgun 2024-08-27 22:50:31 +08:00
parent 3cc678f09e
commit b64ca8b300

View File

@ -16,7 +16,7 @@ import { DialogWrapper } from '@/components/DialogWrapper';
import { useSocketSubscribeList } from '@/api/socketio'; import { useSocketSubscribeList } from '@/api/socketio';
import { useMemo } from 'react'; import { useMemo } from 'react';
import { DynamicVirtualList } from '@/components/DynamicVirtualList'; import { DynamicVirtualList } from '@/components/DynamicVirtualList';
import { reverse } from 'lodash-es'; import { get, reverse } from 'lodash-es';
export const Route = createFileRoute('/feed/$channelId/')({ export const Route = createFileRoute('/feed/$channelId/')({
beforeLoad: routeAuthBeforeLoad, beforeLoad: routeAuthBeforeLoad,
@ -127,7 +127,7 @@ function PageComponent() {
hasNextPage={hasNextPage} hasNextPage={hasNextPage}
isFetchingNextPage={isFetchingNextPage} isFetchingNextPage={isFetchingNextPage}
onFetchNextPage={fetchNextPage} onFetchNextPage={fetchNextPage}
getItemKey={(index) => fullEvents[index].id} getItemKey={(index) => get(fullEvents, [index, 'id'])}
renderItem={(item) => ( renderItem={(item) => (
<FeedEventItem className="animate-fade-in mb-2" event={item} /> <FeedEventItem className="animate-fade-in mb-2" event={item} />
)} )}