@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.esm.js CHANGED
@@ -1405,6 +1405,7 @@ var Response = class _Response {
1405
1405
  this.requestParams = requestParams;
1406
1406
  this.response = response;
1407
1407
  this.originatingPage = originatingPage;
1408
+ this.wasPrefetched = false;
1408
1409
  }
1409
1410
  static create(params, response, originatingPage) {
1410
1411
  return new _Response(params, response, originatingPage);
@@ -1419,6 +1420,7 @@ var Response = class _Response {
1419
1420
  }
1420
1421
  async process() {
1421
1422
  if (this.requestParams.all().prefetch) {
1423
+ this.wasPrefetched = true;
1422
1424
  this.requestParams.all().prefetch = false;
1423
1425
  this.requestParams.all().onPrefetched(this.response, this.requestParams.all());
1424
1426
  firePrefetchedEvent(this.response, this.requestParams.all());
@@ -1438,6 +1440,9 @@ var Response = class _Response {
1438
1440
  return this.requestParams.all().onError(scopedErrors);
1439
1441
  }
1440
1442
  router.flushByCacheTags(this.requestParams.all().invalidateCacheTags || []);
1443
+ if (!this.wasPrefetched) {
1444
+ router.flush(page.get().url);
1445
+ }
1441
1446
  fireSuccessEvent(page.get());
1442
1447
  await this.requestParams.all().onSuccess(page.get());
1443
1448
  history.preserveUrl = false;