mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-09-23 20:18:42 +08: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([
|
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$,
|
shared$,
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([ordered, last]) => {
|
map(([ordered, last]) => {
|
||||||
@@ -201,7 +207,13 @@ export class CollectionRulesService extends Service {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
return combineLatest([
|
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$,
|
shared$,
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([grouped, last]) => {
|
map(([grouped, last]) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user