Skip to content

Commit

Permalink
Ensure we store the latest Entry uri (#392)
Browse files Browse the repository at this point in the history
* Ensure we store the latest Entry uri

* A better approach
  • Loading branch information
ryanmitchell authored Dec 12, 2024
1 parent 95c5113 commit d5874bb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Entries/Entry.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,15 @@ public static function makeModelFromContract(EntryContract $source)
Blink::store('entry-uris')->forget($source->id());
}

// disable the uri cache so any slug updates give us the latest slug
$source->structure()?->in($source->locale())->disableUriCache();

$attributes = [
...$attributes,
'origin_id' => $origin?->id(),
'site' => $source->locale(),
'slug' => $source->slug(),
'uri' => $source->uri(),
'uri' => $source->uri() ?? $source->routableUri(),
'date' => $date,
'collection' => $source->collectionHandle(),
'blueprint' => $source->blueprint ?? $source->blueprint()->handle(),
Expand Down

0 comments on commit d5874bb

Please sign in to comment.