mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-14 13:25:12 +00:00
fix(core): fix groupBy and orderBy error handling (#12584)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -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<string, Set<string>>());
|
||||
})
|
||||
),
|
||||
shared$,
|
||||
]).pipe(
|
||||
map(([grouped, last]) => {
|
||||
|
||||
Reference in New Issue
Block a user