@inertiajs/core 2.3.0 → 2.3.2

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 CHANGED
@@ -574,12 +574,13 @@ var prefetchedRequests = new PrefetchedRequests();
574
574
  // src/scroll.ts
575
575
  var Scroll = class {
576
576
  static save() {
577
- history.saveScrollPositions(
578
- Array.from(this.regions()).map((region) => ({
579
- top: region.scrollTop,
580
- left: region.scrollLeft
581
- }))
582
- );
577
+ history.saveScrollPositions(this.getScrollRegions());
578
+ }
579
+ static getScrollRegions() {
580
+ return Array.from(this.regions()).map((region) => ({
581
+ top: region.scrollTop,
582
+ left: region.scrollLeft
583
+ }));
583
584
  }
584
585
  static regions() {
585
586
  return document.querySelectorAll("[scroll-region]");
@@ -818,7 +819,7 @@ var CurrentPage = class {
818
819
  page2.rememberedState ?? (page2.rememberedState = {});
819
820
  const isServer2 = typeof window === "undefined";
820
821
  const location = !isServer2 ? window.location : new URL(page2.url);
821
- const scrollRegions = !isServer2 && preserveScroll ? history.getScrollRegions() : [];
822
+ const scrollRegions = !isServer2 && preserveScroll ? Scroll.getScrollRegions() : [];
822
823
  replace = replace || isSameUrlWithoutHash(hrefToUrl(page2.url), location);
823
824
  return new Promise((resolve) => {
824
825
  replace ? history.replaceState(page2, () => resolve(null)) : history.pushState(page2, () => resolve(null));