Skip to content

Commit

Permalink
Experiment: try memo to avoid terrible typing lag when list view is open
Browse files Browse the repository at this point in the history
  • Loading branch information
gwwar committed Jul 30, 2021
1 parent 7481f98 commit 6bdf425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
store as blockEditorStore,
} from '@wordpress/block-editor';
import { Button } from '@wordpress/components';
import { memo } from '@wordpress/element';
import {
useFocusOnMount,
useFocusReturn,
Expand All @@ -22,7 +23,7 @@ import { ESCAPE } from '@wordpress/keycodes';
*/
import { store as editPostStore } from '../../store';

export default function ListViewSidebar() {
function ListViewSidebar() {
const { setIsListViewOpened } = useDispatch( editPostStore );

const { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );
Expand Down Expand Up @@ -71,3 +72,4 @@ export default function ListViewSidebar() {
</div>
);
}
export default memo( ListViewSidebar );
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
useInstanceId,
useMergeRefs,
} from '@wordpress/compose';
import { memo } from '@wordpress/element';
import { useDispatch } from '@wordpress/data';
import { __ } from '@wordpress/i18n';
import { closeSmall } from '@wordpress/icons';
Expand All @@ -22,7 +23,7 @@ import { ESCAPE } from '@wordpress/keycodes';
*/
import { store as editSiteStore } from '../../store';

export default function ListViewSidebar() {
function ListViewSidebar() {
const { setIsListViewOpened } = useDispatch( editSiteStore );

const { clearSelectedBlock, selectBlock } = useDispatch( blockEditorStore );
Expand Down Expand Up @@ -70,3 +71,4 @@ export default function ListViewSidebar() {
</div>
);
}
export default memo( ListViewSidebar );

0 comments on commit 6bdf425

Please sign in to comment.