@inertiajs/core 2.3.0 → 2.3.1

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.js CHANGED
@@ -631,12 +631,13 @@ var prefetchedRequests = new PrefetchedRequests();
631
631
  // src/scroll.ts
632
632
  var Scroll = class {
633
633
  static save() {
634
- history.saveScrollPositions(
635
- Array.from(this.regions()).map((region) => ({
636
- top: region.scrollTop,
637
- left: region.scrollLeft
638
- }))
639
- );
634
+ history.saveScrollPositions(this.getScrollRegions());
635
+ }
636
+ static getScrollRegions() {
637
+ return Array.from(this.regions()).map((region) => ({
638
+ top: region.scrollTop,
639
+ left: region.scrollLeft
640
+ }));
640
641
  }
641
642
  static regions() {
642
643
  return document.querySelectorAll("[scroll-region]");
@@ -875,7 +876,7 @@ var CurrentPage = class {
875
876
  page2.rememberedState ?? (page2.rememberedState = {});
876
877
  const isServer2 = typeof window === "undefined";
877
878
  const location = !isServer2 ? window.location : new URL(page2.url);
878
- const scrollRegions = !isServer2 && preserveScroll ? history.getScrollRegions() : [];
879
+ const scrollRegions = !isServer2 && preserveScroll ? Scroll.getScrollRegions() : [];
879
880
  replace = replace || isSameUrlWithoutHash(hrefToUrl(page2.url), location);
880
881
  return new Promise((resolve) => {
881
882
  replace ? history.replaceState(page2, () => resolve(null)) : history.pushState(page2, () => resolve(null));