@inertiajs/core 2.3.6 → 2.3.8
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/dist/index.esm.js +9 -3
- package/dist/index.esm.js.map +2 -2
- package/dist/index.js +9 -3
- package/dist/index.js.map +2 -2
- package/package.json +1 -1
- package/types/infiniteScroll/data.d.ts +1 -0
- package/types/types.d.ts +7 -4
package/dist/index.js
CHANGED
|
@@ -792,7 +792,7 @@ function mergeDataIntoQueryString(method, href, data, qsArrayFormat = "brackets"
|
|
|
792
792
|
const hasHash = href.toString().includes("#");
|
|
793
793
|
const url = new URL(href.toString(), typeof window === "undefined" ? "http://localhost" : window.location.toString());
|
|
794
794
|
if (hasDataForQueryString) {
|
|
795
|
-
const hasIndices = /\[\d+\]/.test(url.search);
|
|
795
|
+
const hasIndices = /\[\d+\]/.test(decodeURIComponent(url.search));
|
|
796
796
|
const parseOptions = { ignoreQueryPrefix: true, allowSparse: true };
|
|
797
797
|
url.search = qs.stringify(
|
|
798
798
|
{ ...qs.parse(url.search, parseOptions), ...data },
|
|
@@ -1173,6 +1173,10 @@ var History = class {
|
|
|
1173
1173
|
return window.history.state?.documentScrollPosition || { top: 0, left: 0 };
|
|
1174
1174
|
}
|
|
1175
1175
|
replaceState(page2, cb = null) {
|
|
1176
|
+
if ((0, import_lodash_es3.isEqual)(this.current, page2)) {
|
|
1177
|
+
cb && cb();
|
|
1178
|
+
return;
|
|
1179
|
+
}
|
|
1176
1180
|
page.merge(page2);
|
|
1177
1181
|
if (isServer) {
|
|
1178
1182
|
return;
|
|
@@ -1440,7 +1444,7 @@ var InitialVisit = class {
|
|
|
1440
1444
|
fireNavigateEvent(page2);
|
|
1441
1445
|
const flash = page2.flash;
|
|
1442
1446
|
if (Object.keys(flash).length > 0) {
|
|
1443
|
-
fireFlashEvent(flash);
|
|
1447
|
+
queueMicrotask(() => fireFlashEvent(flash));
|
|
1444
1448
|
}
|
|
1445
1449
|
});
|
|
1446
1450
|
}
|
|
@@ -3080,6 +3084,7 @@ var useInfiniteScrollData = (options) => {
|
|
|
3080
3084
|
const removeEventListener = router.on("success", (event) => {
|
|
3081
3085
|
if (state.component === event.detail.page.component && getScrollPropFromCurrentPage().reset) {
|
|
3082
3086
|
resetState();
|
|
3087
|
+
options.onReset?.();
|
|
3083
3088
|
}
|
|
3084
3089
|
});
|
|
3085
3090
|
const getScrollPropKeyForSide = (side) => {
|
|
@@ -3496,7 +3501,8 @@ function useInfiniteScroll(options) {
|
|
|
3496
3501
|
onCompleteNextRequest: (loadedPage) => {
|
|
3497
3502
|
options.onCompleteNextRequest();
|
|
3498
3503
|
requestAnimationFrame(() => elementManager.processServerLoadedElements(loadedPage), 2);
|
|
3499
|
-
}
|
|
3504
|
+
},
|
|
3505
|
+
onReset: options.onDataReset
|
|
3500
3506
|
});
|
|
3501
3507
|
const addScrollPreservationCallbacks = (reloadOptions) => {
|
|
3502
3508
|
const { captureScrollPosition, restoreScrollPosition } = scrollPreservation.createCallbacks();
|