-
-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Desktop: Resolves #4251: Refactor sidebar to better handle thousands of tags and notebooks #10331
Desktop: Resolves #4251: Refactor sidebar to better handle thousands of tags and notebooks #10331
Conversation
packages/app-desktop/gui/Sidebar/listItemComponents/FolderItem.tsx
Outdated
Show resolved
Hide resolved
|
With this pull request is it faster to render the list of tags? Also I think the problem that this user is having is due to having many tags, and every time a sync operation is performed the tag list is rendered (slowly) again. I'm wondering if your PR would help with this? See also here for example: https://discourse.joplinapp.org/t/desktop-ui-is-too-slow-to-work-efficiently/23657/10?u=laurent |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite a big refactoring and difficult to review but I didn't notice any obvious issue other than the folder/notebook issue. Splitting the sidebar into multiple components should definitely help with optimising it.
| } | ||
|
|
||
|
|
||
| const NotebookAndTagList: React.FC<Props> = props => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be FolderAndTagList. There are several instances of "notebook" being used in this pull request instead of "folder" so if you could change everything to "folder" that would be great. As always, we only use the term "notebook" in user-facing string, and only "folder" internally.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've made this change in most places.
For now, I've left sidebar.spec.ts as-is, because Playwright is accessing user-facing labels (which use "notebook") to run the test. I can change the internal variable names there well if desired.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer we use "folder" there too if that's ok, including in test descriptions, and even when creating folders for test (So "Folder A" instead of "Notebook A").
Basically the only time we should use the term "notebook" is in strings to be translated or in documentation. Ideally we'd change everything to use only one term or the other, but that would be more trouble than it's worth.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! This should be addressed by 97ec1a9.
Yes. This pull request refactors the sidebar to use an It still needs to load the sorted list of tags and folders, but does so less often than before this pull request. Additionally, switching notebooks/tags should be faster (see the screen recording above):
This pull request should help with that (see the "Faster tagging" video above for an example). |
| itemRenderer={onRenderItem} | ||
| onKeyDown={onKeyEventHandler} | ||
|
|
||
| itemHeight={30} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure I like hardcoding the item height as 30... Doing so makes it difficult to force a larger-than-30px sidebar font with custom CSS.
Aside from measuring one of the children (e.g. with .clientHeight), I'm not sure how else to do this, however.
packages/app-desktop/gui/Sidebar/listItemComponents/AllNotesItem.tsx
Outdated
Show resolved
Hide resolved
The focus handler test is occasionally failing in CI. Hypothesizing that this issue is caused by the note counter updating (and perhaps causing the sidebar to be re-focused), the text selector for folder A is updated
Rather than using mainWindow.keyboard.press, uses locator.press, which seems to be the recommended way to test keyboard events (per the docs)
added to the note list
|
There's a conflict on the Sidebar file |
Summary
This pull request refactors the desktop sidebar to:
With this pull request,
Fixes #4251.
Notes
30px.Sidebar.tsxhas been moved to theuseOnRenderItem.tshook.doRefreshFolderstotrueinstead ofnowhere (truecauses a delayed update, whilenowupdates without delay).To-do
Manual testing
On Ubuntu 23.10, I have manually verified that:
ItemList, which is refactored by this pull request.Note that this pull request has automated tests, which additionally tests:
Screen recordings
Faster notebook switching
faster-notebook-switching.mp4
Faster tagging
In the recording below, the main screen is open in the background in both copies of Joplin. The numbers of notes/tags/notebooks in both profiles are similar to in the tests done here.
faster-tagging.mp4