Skip to content

Commit

Permalink
fix: Show All Recipes in Cookbook Regardless of Sort (#4908)
Browse files Browse the repository at this point in the history
Co-authored-by: Kuchenpirat <[email protected]>
  • Loading branch information
michael-genson and Kuchenpirat authored Jan 20, 2025
1 parent c096605 commit 0d96ec3
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
5 changes: 4 additions & 1 deletion frontend/components/Domain/Cookbook/CookbookPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,12 @@
}
const response = await actions.updateOne(editTarget.value);
// if name changed, redirect to new slug
if (response?.slug && book.value?.slug !== response?.slug) {
// if name changed, redirect to new slug
router.push(`/g/${route.value.params.groupSlug}/cookbooks/${response?.slug}`);
} else {
// otherwise reload the page, since the recipe criteria changed
router.go(0);
}
dialogStates.edit = false;
editTarget.value = null;
Expand Down
24 changes: 14 additions & 10 deletions frontend/components/Domain/Recipe/RecipeCardSection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,20 @@ export default defineComponent({
const router = useRouter();
const queryFilter = computed(() => {
const orderBy = props.query?.orderBy || preferences.value.orderBy;
const orderByFilter = preferences.value.filterNull && orderBy ? `${orderBy} IS NOT NULL` : null;
if (props.query.queryFilter && orderByFilter) {
return `(${props.query.queryFilter}) AND ${orderByFilter}`;
} else if (props.query.queryFilter) {
return props.query.queryFilter;
} else {
return orderByFilter;
}
return props.query.queryFilter || null;
// TODO: allow user to filter out null values when ordering by a value that may be null (such as lastMade)
// const orderBy = props.query?.orderBy || preferences.value.orderBy;
// const orderByFilter = preferences.value.filterNull && orderBy ? `${orderBy} IS NOT NULL` : null;
// if (props.query.queryFilter && orderByFilter) {
// return `(${props.query.queryFilter}) AND ${orderByFilter}`;
// } else if (props.query.queryFilter) {
// return props.query.queryFilter;
// } else {
// return orderByFilter;
// }
});
async function fetchRecipes(pageCount = 1) {
Expand Down
1 change: 1 addition & 0 deletions mealie/repos/repository_recipes.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ def page_all( # type: ignore
# Apply options late, so they do not get used for counting
q = q.options(*RecipeSummary.loader_options())
try:
self.logger.debug(f"Recipe Pagination Query: {pagination_result}")
data = self.session.execute(q).scalars().unique().all()
except Exception as e:
self._log_exception(e)
Expand Down

0 comments on commit 0d96ec3

Please sign in to comment.