mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-09-01 11:39:21 +02:00
core: early return when items are empty
This commit is contained in:
committed by
Abdullah Atta
parent
90ad4ca988
commit
79f107bb4d
@@ -306,6 +306,7 @@ export class FilteredSelector<T extends Item> {
|
||||
}
|
||||
|
||||
async items(ids?: string[], sortOptions?: SortOptions) {
|
||||
if (ids && !ids?.length) return [];
|
||||
return (await this.filter
|
||||
.$if(!!ids && ids.length > 0, (eb) => eb.where("id", "in", ids!))
|
||||
.$if(!!sortOptions, (eb) =>
|
||||
@@ -318,6 +319,7 @@ export class FilteredSelector<T extends Item> {
|
||||
}
|
||||
|
||||
async records(ids?: string[], sortOptions?: SortOptions) {
|
||||
if (ids && !ids?.length) return {};
|
||||
const results = await this.items(ids, sortOptions);
|
||||
const items: Record<string, T> = {};
|
||||
for (const item of results) {
|
||||
|
||||
Reference in New Issue
Block a user