Whenever I refresh my page, the forEach is being run twice. Both on server & client, resulting in duplicate ingredients (and hydration mismatch). If I just navigate to it (without ssr) it works.
Why is is the foreach run twice?
// ...
const { data } = await useApi<{ recipe: Recipe }>(`/recipes/${route.params.slug}`)
data.value.recipe.ingredients.forEach((ingredient: Ingredient) => {
shoppingCart.add(ingredient.product);
})
</script>