From 36baf3e5725aeae00d81d3a082b3c04074e09f8e Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Wed, 15 Nov 2023 17:09:13 +0100
Subject: refactor(hooks): replace useRouteChange with useOnRouteChange hook

* handle both event start and event complete
* clean the effect
* add tests
---
 src/components/templates/layout/layout.tsx | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

(limited to 'src/components/templates/layout/layout.tsx')

diff --git a/src/components/templates/layout/layout.tsx b/src/components/templates/layout/layout.tsx
index 5dad8a2..055b1a1 100644
--- a/src/components/templates/layout/layout.tsx
+++ b/src/components/templates/layout/layout.tsx
@@ -19,7 +19,7 @@ import { ROUTES } from '../../../utils/constants';
 import {
   useAutofocus,
   useBoolean,
-  useRouteChange,
+  useOnRouteChange,
   useScrollPosition,
 } from '../../../utils/hooks';
 import {
@@ -271,7 +271,7 @@ export const Layout: FC<LayoutProps> = ({
     [intl, router]
   );
 
-  useRouteChange(deactivateSearch);
+  useOnRouteChange(deactivateSearch);
 
   const navbarItems: NavbarItems = [
     {
@@ -382,7 +382,7 @@ export const Layout: FC<LayoutProps> = ({
     if (topRef.current) topRef.current.focus();
   };
 
-  useRouteChange(giveFocusToTopRef);
+  useOnRouteChange(giveFocusToTopRef);
 
   const brandingTitleStyles = {
     '--typing-animation':
-- 
cgit v1.2.3

