oihana-next-ui 0.1.43 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
'use client' ;
|
|
29
29
|
|
|
30
|
-
import { useState } from 'react' ;
|
|
30
|
+
import { useCallback , useState } from 'react' ;
|
|
31
31
|
|
|
32
32
|
import { MdMenu as MenuIcon } from 'react-icons/md' ;
|
|
33
33
|
|
|
@@ -72,8 +72,8 @@ const Dashboard =
|
|
|
72
72
|
|
|
73
73
|
const [ drawerOpen , setDrawerOpen ] = useState( false ) ;
|
|
74
74
|
|
|
75
|
-
const openDrawer = () => setDrawerOpen( true ) ;
|
|
76
|
-
const closeDrawer = () => setDrawerOpen( false ) ;
|
|
75
|
+
const openDrawer = useCallback( () => setDrawerOpen( true ) , [] ) ;
|
|
76
|
+
const closeDrawer = useCallback( () => setDrawerOpen( false ) , [] ) ;
|
|
77
77
|
|
|
78
78
|
const bp = breakpoint ?? 'lg' ;
|
|
79
79
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { useEffect } from 'react' ;
|
|
2
|
-
import { usePathname } from 'next/navigation' ;
|
|
2
|
+
import { usePathname , useSearchParams } from 'next/navigation' ;
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Resets scroll position when the route (pathname) changes.
|
|
5
|
+
* Resets scroll position when the route (pathname or searchParams) changes.
|
|
6
6
|
*
|
|
7
7
|
* @param {React.RefObject} [ref] - Optional scroll container ref.
|
|
8
8
|
* @param {boolean} [disabled=false]
|
|
@@ -17,7 +17,8 @@ const useResetScroll =
|
|
|
17
17
|
behavior = 'smooth'
|
|
18
18
|
) =>
|
|
19
19
|
{
|
|
20
|
-
const pathname
|
|
20
|
+
const pathname = usePathname() ;
|
|
21
|
+
const searchParams = useSearchParams() ;
|
|
21
22
|
|
|
22
23
|
useEffect( () =>
|
|
23
24
|
{
|
|
@@ -32,7 +33,7 @@ const useResetScroll =
|
|
|
32
33
|
|
|
33
34
|
element.scrollTo( { top : 0 , behavior } ) ;
|
|
34
35
|
}
|
|
35
|
-
, [ behavior , disabled , pathname , ref , scrollClassName ] ) ;
|
|
36
|
+
, [ behavior , disabled , pathname , searchParams , ref , scrollClassName ] ) ;
|
|
36
37
|
} ;
|
|
37
38
|
|
|
38
39
|
export default useResetScroll ;
|
package/src/version.js
CHANGED