@inertiajs/core 2.1.5 → 2.1.6

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
@@ -1454,6 +1454,7 @@ var Response = class _Response {
1454
1454
  this.requestParams = requestParams;
1455
1455
  this.response = response;
1456
1456
  this.originatingPage = originatingPage;
1457
+ this.wasPrefetched = false;
1457
1458
  }
1458
1459
  static create(params, response, originatingPage) {
1459
1460
  return new _Response(params, response, originatingPage);
@@ -1468,6 +1469,7 @@ var Response = class _Response {
1468
1469
  }
1469
1470
  async process() {
1470
1471
  if (this.requestParams.all().prefetch) {
1472
+ this.wasPrefetched = true;
1471
1473
  this.requestParams.all().prefetch = false;
1472
1474
  this.requestParams.all().onPrefetched(this.response, this.requestParams.all());
1473
1475
  firePrefetchedEvent(this.response, this.requestParams.all());
@@ -1487,6 +1489,9 @@ var Response = class _Response {
1487
1489
  return this.requestParams.all().onError(scopedErrors);
1488
1490
  }
1489
1491
  router.flushByCacheTags(this.requestParams.all().invalidateCacheTags || []);
1492
+ if (!this.wasPrefetched) {
1493
+ router.flush(page.get().url);
1494
+ }
1490
1495
  fireSuccessEvent(page.get());
1491
1496
  await this.requestParams.all().onSuccess(page.get());
1492
1497
  history.preserveUrl = false;