mirror of https://github.com/laurent22/joplin.git
Desktop: Fixes #7610: Optimise sidebar rendering speed
parent
fa7d48a3bd
commit
488e469e33
|
@ -135,8 +135,7 @@ const SidebarComponent = (props: Props) => {
|
||||||
tagItemsOrder_.current = [];
|
tagItemsOrder_.current = [];
|
||||||
|
|
||||||
const rootRef = useRef(null);
|
const rootRef = useRef(null);
|
||||||
const anchorItemRefs = useRef<Record<string, any>>(null);
|
const anchorItemRefs = useRef<Record<string, any>>({});
|
||||||
anchorItemRefs.current = {};
|
|
||||||
|
|
||||||
// This whole component is a bit of a mess and rather than passing
|
// This whole component is a bit of a mess and rather than passing
|
||||||
// a plugins prop around, not knowing how it's going to affect
|
// a plugins prop around, not knowing how it's going to affect
|
||||||
|
@ -695,6 +694,11 @@ const SidebarComponent = (props: Props) => {
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const foldersStyle = useMemo(() => {
|
||||||
|
return { display: props.folderHeaderIsExpanded ? 'block' : 'none', paddingBottom: 10 };
|
||||||
|
}, [props.folderHeaderIsExpanded]);
|
||||||
|
|
||||||
|
|
||||||
if (props.folders.length) {
|
if (props.folders.length) {
|
||||||
const allNotesSelected = props.notesParentType === 'SmartFilter' && props.selectedSmartFilterId === ALL_NOTES_FILTER_ID;
|
const allNotesSelected = props.notesParentType === 'SmartFilter' && props.selectedSmartFilterId === ALL_NOTES_FILTER_ID;
|
||||||
const result = shared.renderFolders(props, renderFolderItem);
|
const result = shared.renderFolders(props, renderFolderItem);
|
||||||
|
@ -704,7 +708,7 @@ const SidebarComponent = (props: Props) => {
|
||||||
<div
|
<div
|
||||||
className={`folders ${props.folderHeaderIsExpanded ? 'expanded' : ''}`}
|
className={`folders ${props.folderHeaderIsExpanded ? 'expanded' : ''}`}
|
||||||
key="folder_items"
|
key="folder_items"
|
||||||
style={{ display: props.folderHeaderIsExpanded ? 'block' : 'none', paddingBottom: 10 }}
|
style={foldersStyle}
|
||||||
>
|
>
|
||||||
{folderItems}
|
{folderItems}
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue