Skip to content

Commit

Permalink
Update .changeset/lovely-nails-cough.md
Browse files Browse the repository at this point in the history
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
  • Loading branch information
matthewp and sarah11918 committed Mar 7, 2024
1 parent 583aefc commit 4a99bab
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions .changeset/lovely-nails-cough.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ For example, the component below is set to persist across navigation. This compo
<ProductListing transition:persist products={products} />
```

This component might have some internal state, such as which filters are applied. Upon navigation, this component persists, but the underlying `products` might change, for example if you are visiting a category of products, or you are performing a search.
Upon navigation, this component persists, but the desired `products` might change, for example if you are visiting a category of products, or you are performing a search.

Previously the props will not change on navigation, and your island would have to handle updating them externally, such as with API calls.
Previously the props would not change on navigation, and your island would have to handle updating them externally, such as with API calls.

With this change the props are now updated, while still preserving state.

You can override this new default behavior on a per-component basis using `transition:persist-props=true` to persist both props and state during navigation:

```astro
<ProductListing transition:persist-props=true products={products} />
```

0 comments on commit 4a99bab

Please sign in to comment.