Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
- Fix English grammar in translatable string
[#1907](https://github.com/nextcloud/cookbook/pull/1907) @rakekniven
- Fix flashing pages on fast internet connections. See [#1891]((https://github.com/nextcloud/cookbook/issues/1891))
[#1896](https://github.com/nextcloud/cookbook/pull/1896) @seyfeb
[#1896](https://github.com/nextcloud/cookbook/pull/1896)
[#1918](https://github.com/nextcloud/cookbook/pull/1918)@seyfeb
- Less strict character matching when filtering `RecipeList`, ignoring accents and some letters. Closes [#1870]((https://github.com/nextcloud/cookbook/issues/1870))
[#1896](https://github.com/nextcloud/cookbook/pull/1896) @seyfeb
- Make API interface cleaner by only using string identifiers for recipes
Expand Down
16 changes: 15 additions & 1 deletion src/components/SearchResults.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<recipe-list :recipes="results" />
<RecipeList :recipes="results" :loading="isLoadingRecipeList" />
</div>
</template>

Expand Down Expand Up @@ -31,6 +31,11 @@ const props = defineProps({
* @type {import('vue').Ref<boolean>}
*/
const isComponentActive = ref(true);
/**
* If the list of recipes is currently being fetched from the server.
* @type {import('vue').Ref<boolean>}
*/
const isLoadingRecipeList = ref(false);
/**
* @type {import('vue').Ref<Array>}
*/
Expand All @@ -50,6 +55,7 @@ const setup = async () => {
// Search by tags
const tags = route.params.value;
try {
isLoadingRecipeList.value = true;
const response = await api.recipes.allWithTag(tags);
results.value = response.data;
} catch (e) {
Expand All @@ -65,11 +71,14 @@ const setup = async () => {
if (e && e instanceof Error) {
throw e;
}
} finally {
isLoadingRecipeList.value = false;
}
} else if (props.query === 'cat') {
// Search by category
const cat = route.params.value;
try {
isLoadingRecipeList.value = true;
const response = await api.recipes.allInCategory(cat);
results.value = response.data;
} catch (e) {
Expand All @@ -85,10 +94,13 @@ const setup = async () => {
if (e && e instanceof Error) {
throw e;
}
} finally {
isLoadingRecipeList.value = false;
}
} else {
// General search
try {
isLoadingRecipeList.value = true;
const response = await api.recipes.search(route.params.value);
results.value = response.data;
} catch (e) {
Expand All @@ -99,6 +111,8 @@ const setup = async () => {
if (e && e instanceof Error) {
throw e;
}
} finally {
isLoadingRecipeList.value = false;
}
store.dispatch('setPage', { page: 'search' });
}
Expand Down