mirror of
https://github.com/xuquan-nikkkki/FolderFile-Splitter-Plugin.git
synced 2026-07-22 05:37:28 +00:00
fix: avoid duplicate key in files list when focus on tag
This commit is contained in:
parent
47a2a03856
commit
e4daa6982a
2 changed files with 6 additions and 6 deletions
|
|
@ -8,7 +8,7 @@ import { ExplorerStore } from "src/store";
|
|||
import { PinContainer, PinContent, PinHeader } from "../Pin";
|
||||
|
||||
type Props = {
|
||||
renderFile: (file: TFile, disableDrag?: boolean) => ReactNode;
|
||||
renderFile: (file: TFile, index: number, disableDrag?: boolean) => ReactNode;
|
||||
};
|
||||
const PinnedFiles = ({ renderFile }: Props) => {
|
||||
const { useExplorerStore } = useExplorer();
|
||||
|
|
@ -26,8 +26,8 @@ const PinnedFiles = ({ renderFile }: Props) => {
|
|||
<PinContainer>
|
||||
<PinHeader />
|
||||
<PinContent>
|
||||
{getDisplayedPinnedFiles().map((file) =>
|
||||
renderFile(file, true)
|
||||
{getDisplayedPinnedFiles().map((file, index) =>
|
||||
renderFile(file, index, true)
|
||||
)}
|
||||
</PinContent>
|
||||
</PinContainer>
|
||||
|
|
|
|||
|
|
@ -27,9 +27,9 @@ const FileTree = ({ onOpenFoldersPane = () => {} }: Props) => {
|
|||
);
|
||||
const { files } = useChangeFile();
|
||||
|
||||
const renderFile = (file: TFile, disableDrag?: boolean) => (
|
||||
const renderFile = (file: TFile, index: number, disableDrag?: boolean) => (
|
||||
<File
|
||||
key={file.path}
|
||||
key={file.path + index}
|
||||
file={file}
|
||||
disableDrag={disableDrag}
|
||||
onOpenFoldersPane={onOpenFoldersPane}
|
||||
|
|
@ -48,7 +48,7 @@ const FileTree = ({ onOpenFoldersPane = () => {} }: Props) => {
|
|||
return (
|
||||
<div className="ffs__tree ffs__file-tree nav-files-container">
|
||||
<PinnedFiles renderFile={renderFile} />
|
||||
{sortedFiles.map((file) => renderFile(file))}
|
||||
{sortedFiles.map((file, index) => renderFile(file, index))}
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue