From b3503d53f2e7af280afeee92aa037b1e79c4737e Mon Sep 17 00:00:00 2001 From: George Mamadashvili Date: Mon, 25 Mar 2024 18:09:55 +0400 Subject: [PATCH] DataViews: Don't memoize every callback 'PagePages' component (#60103) Co-authored-by: Mamaduka Co-authored-by: oandregal --- .../src/components/page-pages/index.js | 32 +++++++------------ 1 file changed, 11 insertions(+), 21 deletions(-) diff --git a/packages/edit-site/src/components/page-pages/index.js b/packages/edit-site/src/components/page-pages/index.js index a01d27f07cc863..1cf1a0b077b6fa 100644 --- a/packages/edit-site/src/components/page-pages/index.js +++ b/packages/edit-site/src/components/page-pages/index.js @@ -377,27 +377,17 @@ export default function PagePages() { ); const [ showAddPageModal, setShowAddPageModal ] = useState( false ); - const openModal = useCallback( () => { - if ( ! showAddPageModal ) { - setShowAddPageModal( true ); - } - }, [ showAddPageModal ] ); - const closeModal = useCallback( () => { - if ( showAddPageModal ) { - setShowAddPageModal( false ); - } - }, [ showAddPageModal ] ); - const handleNewPage = useCallback( - ( { type, id } ) => { - history.push( { - postId: id, - postType: type, - canvas: 'edit', - } ); - closeModal(); - }, - [ history ] - ); + + const openModal = () => setShowAddPageModal( true ); + const closeModal = () => setShowAddPageModal( false ); + const handleNewPage = ( { type, id } ) => { + history.push( { + postId: id, + postType: type, + canvas: 'edit', + } ); + closeModal(); + }; // TODO: we need to handle properly `data={ data || EMPTY_ARRAY }` for when `isLoading`. return (