From a045786c6a860762e9cce0473df5a6680e22da80 Mon Sep 17 00:00:00 2001 From: EYHN Date: Wed, 28 May 2025 06:58:26 +0000 Subject: [PATCH] fix(core): fix groupBy and orderBy error handling (#12584) ## Summary by CodeRabbit - **Bug Fixes** - Improved error handling for ordering and grouping features to prevent disruptions and ensure the app continues running smoothly if errors occur. --- .../services/collection-rules.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/frontend/core/src/modules/collection-rules/services/collection-rules.ts b/packages/frontend/core/src/modules/collection-rules/services/collection-rules.ts index fcb3abdc41..7da9f5d09a 100644 --- a/packages/frontend/core/src/modules/collection-rules/services/collection-rules.ts +++ b/packages/frontend/core/src/modules/collection-rules/services/collection-rules.ts @@ -162,7 +162,13 @@ export class CollectionRulesService extends Service { }) ); return combineLatest([ - orderByProvider.orderBy$(items$, orderBy), + orderByProvider.orderBy$(items$, orderBy).pipe( + catchError(error => { + // Return an empty array when orderBy fails, typically when the orderBy property has been deleted + console.error(error); + return of([]); + }) + ), shared$, ]).pipe( map(([ordered, last]) => { @@ -201,7 +207,13 @@ export class CollectionRulesService extends Service { }) ); return combineLatest([ - groupByProvider.groupBy$(items$, groupBy), + groupByProvider.groupBy$(items$, groupBy).pipe( + catchError(error => { + // Return an empty array when groupBy fails, typically when the groupBy property has been deleted + console.error(error); + return of(new Map>()); + }) + ), shared$, ]).pipe( map(([grouped, last]) => {