mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 10:13:32 -04:00 
			
		
		
		
	fix "no data" error on create meal plan modal (#2263)
This commit is contained in:
		| @@ -8,6 +8,7 @@ export interface UseRecipeSearchReturn { | |||||||
|   error: Ref<string>; |   error: Ref<string>; | ||||||
|   loading: Ref<boolean>; |   loading: Ref<boolean>; | ||||||
|   data: Ref<Recipe[]>; |   data: Ref<Recipe[]>; | ||||||
|  |   trigger(): Promise<void>; | ||||||
| } | } | ||||||
|  |  | ||||||
| /** | /** | ||||||
| @@ -40,7 +41,7 @@ export function useRecipeSearch(api: UserApi): UseRecipeSearchReturn { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     if (data) { |     if (data) { | ||||||
|       recipes.value= data.items; |       recipes.value = data.items; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     loading.value = false; |     loading.value = false; | ||||||
| @@ -54,11 +55,15 @@ export function useRecipeSearch(api: UserApi): UseRecipeSearchReturn { | |||||||
|     { debounce: 500 } |     { debounce: 500 } | ||||||
|   ); |   ); | ||||||
|  |  | ||||||
|  |   async function trigger() { | ||||||
|  |     await searchRecipes(query.value); | ||||||
|  |   } | ||||||
|  |  | ||||||
|   return { |   return { | ||||||
|     query, |     query, | ||||||
|     error, |     error, | ||||||
|     loading, |     loading, | ||||||
|     data: recipes, |     data: recipes, | ||||||
|   } |     trigger, | ||||||
|  |   }; | ||||||
| } | } | ||||||
|   | |||||||
| @@ -206,7 +206,7 @@ | |||||||
| </template> | </template> | ||||||
|  |  | ||||||
| <script lang="ts"> | <script lang="ts"> | ||||||
| import { defineComponent, computed, reactive, ref, watch } from "@nuxtjs/composition-api"; | import { defineComponent, computed, reactive, ref, watch, onMounted } from "@nuxtjs/composition-api"; | ||||||
| import { format } from "date-fns"; | import { format } from "date-fns"; | ||||||
| import { SortableEvent } from "sortablejs"; | import { SortableEvent } from "sortablejs"; | ||||||
| import draggable from "vuedraggable"; | import draggable from "vuedraggable"; | ||||||
| @@ -332,9 +332,12 @@ export default defineComponent({ | |||||||
|     // Search |     // Search | ||||||
|  |  | ||||||
|     const search = useRecipeSearch(api); |     const search = useRecipeSearch(api); | ||||||
|  |  | ||||||
|     const planTypeOptions = usePlanTypeOptions(); |     const planTypeOptions = usePlanTypeOptions(); | ||||||
|      |      | ||||||
|  |     onMounted(async () => { | ||||||
|  |       await search.trigger(); | ||||||
|  |     }); | ||||||
|  |  | ||||||
|     return { |     return { | ||||||
|       state, |       state, | ||||||
|       onMoveCallback, |       onMoveCallback, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user