A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
core: add fn to get cache item
Ammar Ahmed3502469c1dc9
diff --git a/packages/core/src/utils/virtualized-grouping.ts b/packages/core/src/utils/virtualized-grouping.tsindex d81f1e6f0..f2176c0de 100644--- a/packages/core/src/utils/virtualized-grouping.ts+++ b/packages/core/src/utils/virtualized-grouping.ts@@ -61,6 +61,19 @@ export class VirtualizedGrouping<T> {? "header-item": "item";}+ cacheItem(index: number) {+ const batchIndex = Math.floor(index / this.batchSize);+ const batch = this.cache.get(batchIndex);+ if (!batch) return;+ const { items, groups, data } = batch;+ const itemIndexInBatch = index - batchIndex * this.batchSize;+ const group = groups?.get(itemIndexInBatch);+ return {+ item: items[itemIndexInBatch],+ group: group && !group.hidden ? group.group : undefined,+ data: data?.[itemIndexInBatch]+ };+ }item(index: number): Promise<{ item: T; group?: GroupHeader }>;item(