-
Notifications
You must be signed in to change notification settings - Fork 560
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix: Defer re-decorating note when changing search (#2073)
* Fix: Defer re-decorating note when changing search See #1941 See #1982 When we rebuilt the search to return instant results and removed the debounce on the search filter we exposed an issue with note rendering performance that ironically made the new instant search slower than the old one in certain circumstances, namely when a note in the search results takes a very long time to render. The leading reason for the performance issue is that `draft-js` was applying a new decorator to its note on every change to the search field. With the search field updating instantly that left no time for the decorators to redraw (and they were very inefficient to make it worse). In this patch we're delaying the re-decoration until the search field settles. This doesn't eliminate the problem but it should bring it roughly on par with the behavior from before the search updates. Further we have eliminated the `MultiDecorator` dependency since that functionality is provided by `draft-js` itself. Since there's no need to create a composite decorator when the search query doesn't contain any text terms we can futher skip it and only decorate with the checkbox decorator. These changes should make searching tolerant to slow notes and should additionally cut the time it takes to decorate notes approximately in half. * Don't remove multidecorator - leave that for later * Also don't update decorators when switching notes
- Loading branch information
Showing
3 changed files
with
45 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters