From 45c74ff65706ba102e5c8925a51b111437dd44c4 Mon Sep 17 00:00:00 2001 From: Matthew Boynes Date: Wed, 14 Feb 2024 16:56:29 -0500 Subject: [PATCH] Fix invalid use of useCallback Using useCallback in this way inadvertently added a callback layer, leading to setBylineMeta() not actually being called. This meant that bylines were not updated when saving a post. --- client/src/containers/container/index.jsx | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/client/src/containers/container/index.jsx b/client/src/containers/container/index.jsx index 5dee8f93..f4815c03 100644 --- a/client/src/containers/container/index.jsx +++ b/client/src/containers/container/index.jsx @@ -19,9 +19,8 @@ function BylineSlotContainer({ actionReorderProfile: reorderProfile, } = useDispatch(store); - const saveByline = useCallback(() => { - setBylineMeta(dispatch, metaKey); - }, [metaKey]); + // eslint-disable-next-line react-hooks/exhaustive-deps + const saveByline = useCallback(setBylineMeta(dispatch, metaKey), [metaKey]); /** * Save ALL bylines to the post meta in the expected schema.