Skip to content

Commit

Permalink
🐛 fix over-agressive memoization
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacInsoll committed Nov 13, 2024
1 parent c89db89 commit 31e6c90
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions frontend/src/components/FileListView/FolderContentsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,16 @@ export const FolderContentsView = ({ folder }) => {
};

useEffect(() => resetFilters(null), [resetFilters, folderId]);
const props = useMemo(() => {
console.log('FCV props recalculate');
const filteredFiles = filtering ? filterFiles(files, filters) : files;
return {
folderId,
folders: folder.subFolders,
files: filteredFiles,
selectedFileId: fileId,
setSelectedFileId,
};
}, [folderId, filters]);

// don't memo files because it breaks graphicache (IE: file changing rating won't reflect)
const filteredFiles = filtering ? filterFiles(files, filters) : files;
const props = {
folderId,
folders: folder.subFolders,
files: filteredFiles,
selectedFileId: fileId,
setSelectedFileId,
};

console.log('FCV render');
return (
Expand Down

0 comments on commit 31e6c90

Please sign in to comment.