fix: first history entry being fetched twice (#903)
This commit is contained in:
@@ -202,7 +202,6 @@ export const HistoryListContainer: FunctionComponent<Props> = observer(
|
||||
<div className={`min-h-0 overflow-auto py-1.5 h-full`}>
|
||||
{selectedTab === RevisionListTabType.Session && (
|
||||
<SessionHistoryList
|
||||
selectedTab={selectedTab}
|
||||
sessionHistory={sessionHistory}
|
||||
setSelectedRevision={setSelectedRevision}
|
||||
setSelectedRemoteEntry={setSelectedRemoteEntry}
|
||||
@@ -214,12 +213,10 @@ export const HistoryListContainer: FunctionComponent<Props> = observer(
|
||||
remoteHistory={remoteHistory}
|
||||
isFetchingRemoteHistory={isFetchingRemoteHistory}
|
||||
fetchAndSetRemoteRevision={fetchAndSetRemoteRevision}
|
||||
selectedTab={selectedTab}
|
||||
/>
|
||||
)}
|
||||
{selectedTab === RevisionListTabType.Legacy && (
|
||||
<LegacyHistoryList
|
||||
selectedTab={selectedTab}
|
||||
legacyHistory={legacyHistory}
|
||||
setSelectedRevision={setSelectedRevision}
|
||||
setSelectedRemoteEntry={setSelectedRemoteEntry}
|
||||
|
||||
@@ -9,12 +9,10 @@ import {
|
||||
useState,
|
||||
} from 'preact/hooks';
|
||||
import { useListKeyboardNavigation } from '../utils';
|
||||
import { RevisionListTabType } from './HistoryListContainer';
|
||||
import { HistoryListItem } from './HistoryListItem';
|
||||
import { LegacyHistoryEntry } from './utils';
|
||||
|
||||
type Props = {
|
||||
selectedTab: RevisionListTabType;
|
||||
legacyHistory: Action[] | undefined;
|
||||
setSelectedRevision: StateUpdater<
|
||||
HistoryEntry | LegacyHistoryEntry | undefined
|
||||
@@ -25,7 +23,6 @@ type Props = {
|
||||
|
||||
export const LegacyHistoryList: FunctionComponent<Props> = ({
|
||||
legacyHistory,
|
||||
selectedTab,
|
||||
setSelectedRevision,
|
||||
setSelectedRemoteEntry,
|
||||
fetchAndSetLegacyRevision,
|
||||
@@ -56,13 +53,6 @@ export const LegacyHistoryList: FunctionComponent<Props> = ({
|
||||
}
|
||||
}, [firstEntry, selectFirstEntry, selectedItemUrl, setSelectedRevision]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTab === RevisionListTabType.Legacy) {
|
||||
selectFirstEntry();
|
||||
legacyHistoryListRef.current?.focus();
|
||||
}
|
||||
}, [selectFirstEntry, selectedTab]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col w-full h-full focus:shadow-none ${
|
||||
|
||||
@@ -11,7 +11,6 @@ import {
|
||||
} from 'preact/hooks';
|
||||
import { Icon } from '../Icon';
|
||||
import { useListKeyboardNavigation } from '../utils';
|
||||
import { RevisionListTabType } from './HistoryListContainer';
|
||||
import { HistoryListItem } from './HistoryListItem';
|
||||
import { previewHistoryEntryTitle, RemoteRevisionListGroup } from './utils';
|
||||
|
||||
@@ -22,7 +21,6 @@ type RemoteHistoryListProps = {
|
||||
fetchAndSetRemoteRevision: (
|
||||
revisionListEntry: RevisionListEntry
|
||||
) => Promise<void>;
|
||||
selectedTab: RevisionListTabType;
|
||||
};
|
||||
|
||||
export const RemoteHistoryList: FunctionComponent<RemoteHistoryListProps> =
|
||||
@@ -32,7 +30,6 @@ export const RemoteHistoryList: FunctionComponent<RemoteHistoryListProps> =
|
||||
remoteHistory,
|
||||
isFetchingRemoteHistory,
|
||||
fetchAndSetRemoteRevision,
|
||||
selectedTab,
|
||||
}) => {
|
||||
const remoteHistoryListRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -69,13 +66,6 @@ export const RemoteHistoryList: FunctionComponent<RemoteHistoryListProps> =
|
||||
selectedEntryUuid.length,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTab === RevisionListTabType.Remote) {
|
||||
selectFirstEntry();
|
||||
remoteHistoryListRef.current?.focus();
|
||||
}
|
||||
}, [selectFirstEntry, selectedTab]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col w-full h-full focus:shadow-none ${
|
||||
|
||||
@@ -13,12 +13,10 @@ import {
|
||||
useState,
|
||||
} from 'preact/hooks';
|
||||
import { useListKeyboardNavigation } from '../utils';
|
||||
import { RevisionListTabType } from './HistoryListContainer';
|
||||
import { HistoryListItem } from './HistoryListItem';
|
||||
import { LegacyHistoryEntry, ListGroup } from './utils';
|
||||
|
||||
type Props = {
|
||||
selectedTab: RevisionListTabType;
|
||||
sessionHistory: ListGroup<NoteHistoryEntry>[];
|
||||
setSelectedRevision: StateUpdater<
|
||||
HistoryEntry | LegacyHistoryEntry | undefined
|
||||
@@ -28,7 +26,6 @@ type Props = {
|
||||
|
||||
export const SessionHistoryList: FunctionComponent<Props> = ({
|
||||
sessionHistory,
|
||||
selectedTab,
|
||||
setSelectedRevision,
|
||||
setSelectedRemoteEntry,
|
||||
}) => {
|
||||
@@ -67,13 +64,6 @@ export const SessionHistoryList: FunctionComponent<Props> = ({
|
||||
setSelectedRevision,
|
||||
]);
|
||||
|
||||
useEffect(() => {
|
||||
if (selectedTab === RevisionListTabType.Session) {
|
||||
selectFirstEntry();
|
||||
sessionHistoryListRef.current?.focus();
|
||||
}
|
||||
}, [selectFirstEntry, selectedTab]);
|
||||
|
||||
return (
|
||||
<div
|
||||
className={`flex flex-col w-full h-full focus:shadow-none ${
|
||||
|
||||
Reference in New Issue
Block a user