react-instantsearch-nextjs 0.4.2 → 0.4.4
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.
|
@@ -21,11 +21,18 @@ function useInstantSearchRouting(passedRouting, isMounting) {
|
|
|
21
21
|
var searchParams = (0, _navigation.useSearchParams)();
|
|
22
22
|
var routingRef = (0, _react.useRef)(null);
|
|
23
23
|
var onUpdateRef = (0, _react.useRef)(null);
|
|
24
|
+
var isUnmounting = (0, _react.useRef)(false);
|
|
24
25
|
(0, _react.useEffect)(function () {
|
|
25
26
|
if (onUpdateRef.current) {
|
|
26
27
|
onUpdateRef.current();
|
|
27
28
|
}
|
|
28
29
|
}, [pathname, searchParams]);
|
|
30
|
+
(0, _react.useEffect)(function () {
|
|
31
|
+
isUnmounting.current = false;
|
|
32
|
+
return function () {
|
|
33
|
+
isUnmounting.current = true;
|
|
34
|
+
};
|
|
35
|
+
});
|
|
29
36
|
var headers = (0, _useNextHeaders.useNextHeaders)();
|
|
30
37
|
if (passedRouting && !routingRef.current) {
|
|
31
38
|
var browserHistoryOptions = {};
|
|
@@ -41,7 +48,7 @@ function useInstantSearchRouting(passedRouting, isMounting) {
|
|
|
41
48
|
};
|
|
42
49
|
browserHistoryOptions.push = function push(url) {
|
|
43
50
|
// This is to skip the push with empty routeState on dispose as it would clear params set on a <Link>
|
|
44
|
-
if (this.isDisposed) {
|
|
51
|
+
if (this.isDisposed && isUnmounting.current) {
|
|
45
52
|
return;
|
|
46
53
|
}
|
|
47
54
|
history.pushState({}, '', url);
|
|
@@ -14,11 +14,18 @@ export function useInstantSearchRouting(passedRouting, isMounting) {
|
|
|
14
14
|
var searchParams = useSearchParams();
|
|
15
15
|
var routingRef = useRef(null);
|
|
16
16
|
var onUpdateRef = useRef(null);
|
|
17
|
+
var isUnmounting = useRef(false);
|
|
17
18
|
useEffect(function () {
|
|
18
19
|
if (onUpdateRef.current) {
|
|
19
20
|
onUpdateRef.current();
|
|
20
21
|
}
|
|
21
22
|
}, [pathname, searchParams]);
|
|
23
|
+
useEffect(function () {
|
|
24
|
+
isUnmounting.current = false;
|
|
25
|
+
return function () {
|
|
26
|
+
isUnmounting.current = true;
|
|
27
|
+
};
|
|
28
|
+
});
|
|
22
29
|
var headers = useNextHeaders();
|
|
23
30
|
if (passedRouting && !routingRef.current) {
|
|
24
31
|
var browserHistoryOptions = {};
|
|
@@ -34,7 +41,7 @@ export function useInstantSearchRouting(passedRouting, isMounting) {
|
|
|
34
41
|
};
|
|
35
42
|
browserHistoryOptions.push = function push(url) {
|
|
36
43
|
// This is to skip the push with empty routeState on dispose as it would clear params set on a <Link>
|
|
37
|
-
if (this.isDisposed) {
|
|
44
|
+
if (this.isDisposed && isUnmounting.current) {
|
|
38
45
|
return;
|
|
39
46
|
}
|
|
40
47
|
history.pushState({}, '', url);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-instantsearch-nextjs",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.4",
|
|
4
4
|
"description": "React InstantSearch SSR utilities for Next.js",
|
|
5
5
|
"types": "dist/es/index.d.ts",
|
|
6
6
|
"main": "dist/cjs/index.js",
|
|
@@ -49,13 +49,13 @@
|
|
|
49
49
|
"watch:es": "yarn --silent build:es:base --watch"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
|
-
"instantsearch.js": "4.77.
|
|
52
|
+
"instantsearch.js": "4.77.3",
|
|
53
53
|
"next": "15.1.4",
|
|
54
|
-
"react-instantsearch-core": "7.15.
|
|
54
|
+
"react-instantsearch-core": "7.15.3"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
57
|
"next": ">= 13.4 < 16",
|
|
58
58
|
"react-instantsearch": ">= 7.1.0 < 8"
|
|
59
59
|
},
|
|
60
|
-
"gitHead": "
|
|
60
|
+
"gitHead": "7bba206a039bd2f86ce2936cd48e8b2cac2f2928"
|
|
61
61
|
}
|