inertiax-core 11.0.23 → 11.0.25

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
@@ -420,12 +420,19 @@ var History = class {
420
420
  return pageData instanceof ArrayBuffer ? decryptHistory(pageData) : Promise.resolve(pageData);
421
421
  }
422
422
  saveScrollPositions(scrollRegions) {
423
- if (isEqual(this.getScrollRegions(), scrollRegions)) {
423
+ const meaningful = scrollRegions.filter((_, i) => {
424
+ const el = document.querySelectorAll("[scroll-region]")[i];
425
+ return el ? el.scrollHeight > el.clientHeight : false;
426
+ });
427
+ if (meaningful.length === 0) {
428
+ return;
429
+ }
430
+ if (isEqual(this.getScrollRegions(), meaningful)) {
424
431
  return;
425
432
  }
426
433
  const nextState = {
427
434
  ...window.history.state,
428
- scrollRegions
435
+ scrollRegions: meaningful
429
436
  };
430
437
  try {
431
438
  window.history.replaceState(nextState, "");
@@ -3336,6 +3343,14 @@ var Router = class {
3336
3343
  restore(key = "default") {
3337
3344
  return history.restore(key, this.frameId);
3338
3345
  }
3346
+ /**
3347
+ * Restore scroll positions from history state for this frame.
3348
+ * Call after programmatically restoring a frame from history (e.g.
3349
+ * when mounting a Frame that loads page data from the history stack).
3350
+ */
3351
+ restoreScroll() {
3352
+ Scroll.restore(history.getScrollRegions(), this.frameId);
3353
+ }
3339
3354
  on(type, callback) {
3340
3355
  if (typeof window === "undefined") {
3341
3356
  return () => {