mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-09 03:04:54 -04:00
feat: fix recipe rating overwriting (#1756)
Previously, the recipe-ratings component would not sync to the v-modeled value when doing it's own updating. This PR fixes that issue and ensures that the value is pushed up to the parent whether in emit only mode or not.
This commit is contained in:
parent
ce4315f971
commit
2e11e57e0a
@ -4,8 +4,8 @@
|
||||
<v-card v-if="!landscape" width="50%" flat class="d-flex flex-column justify-center align-center">
|
||||
<v-card-text>
|
||||
<v-card-title class="headline pa-0 flex-column align-center">
|
||||
{{ recipe.name }}
|
||||
<RecipeRating :key="recipe.slug" :value="recipe.rating" :name="recipe.name" :slug="recipe.slug" />
|
||||
{{ recipe.name }} {{ recipe.rating }}
|
||||
<RecipeRating :key="recipe.slug" v-model="recipe.rating" :name="recipe.name" :slug="recipe.slug" />
|
||||
</v-card-title>
|
||||
<v-divider class="my-2"></v-divider>
|
||||
<SafeMarkdown :source="recipe.description" />
|
||||
|
@ -19,7 +19,7 @@
|
||||
<RecipeRating
|
||||
v-if="landscape && $vuetify.breakpoint.smAndUp"
|
||||
:key="recipe.slug"
|
||||
:value="recipe.rating"
|
||||
:v-model="recipe.rating"
|
||||
:name="recipe.name"
|
||||
:slug="recipe.slug"
|
||||
/>
|
||||
|
@ -15,7 +15,7 @@
|
||||
<RecipeRating
|
||||
v-if="$vuetify.breakpoint.smAndDown"
|
||||
:key="recipe.slug"
|
||||
:value="recipe.rating"
|
||||
v-model="recipe.rating"
|
||||
:name="recipe.name"
|
||||
:slug="recipe.slug"
|
||||
/>
|
||||
|
@ -53,14 +53,13 @@ export default defineComponent({
|
||||
|
||||
const api = useUserApi();
|
||||
function updateRating(val: number) {
|
||||
if (props.emitOnly) {
|
||||
context.emit("input", val);
|
||||
return;
|
||||
}
|
||||
if (!props.emitOnly) {
|
||||
api.recipes.patchOne(props.slug, {
|
||||
rating: val,
|
||||
});
|
||||
}
|
||||
context.emit("input", val);
|
||||
}
|
||||
|
||||
return { loggedIn, rating, updateRating };
|
||||
},
|
||||
|
Loading…
x
Reference in New Issue
Block a user