Bring projects, wikis, and teams together with AI. AppFlowy is the AI collaborative workspace where you achieve more without losing control of your data. The leading open source Notion alternative.
Dart blogconfluence-alternativecontent-managementcontent-servicesdocumentationflutternote-takingnotion-alternativeproject-managementtask-managementteam-collaborationwiki
fix: can not display rows when rows overthan 1000 (#5777)
Kilu.He864768b3ba9a
diff --git a/frontend/appflowy_web_app/src/application/database-yjs/selector.ts b/frontend/appflowy_web_app/src/application/database-yjs/selector.tsindex 3db157b2fb..c83873b7af 100644--- a/frontend/appflowy_web_app/src/application/database-yjs/selector.ts+++ b/frontend/appflowy_web_app/src/application/database-yjs/selector.ts@@ -12,7 +12,6 @@ import {useDatabase,useDatabaseFields,useDatabaseView,- useIsDatabaseRowPage,useRowDocMap,useViewId,} from '@/application/database-yjs/context';@@ -434,7 +433,6 @@ export function useRowsByGroup(groupId: string) {}export function useRowOrdersSelector() {- const isDatabaseRowPage = useIsDatabaseRowPage();const { rows, clock } = useRowDocMapSelector();const [rowOrders, setRowOrders] = useState<Row[]>();const view = useDatabaseView();@@ -446,7 +444,6 @@ export function useRowOrdersSelector() {if (!originalRowOrders || !rows) return;- if (originalRowOrders.length > rows.size && !isDatabaseRowPage) return;if (sorts?.length === 0 && filters?.length === 0) {setRowOrders(originalRowOrders);return;@@ -467,7 +464,7 @@ export function useRowOrdersSelector() {} else {setRowOrders(originalRowOrders);}- }, [fields, filters, rows, sorts, view, isDatabaseRowPage]);+ }, [fields, filters, rows, sorts, view]);useEffect(() => {onConditionsChange();diff --git a/frontend/appflowy_web_app/src/application/services/js-services/cache/index.ts b/frontend/appflowy_web_app/src/application/services/js-services/cache/index.tsindex d33bf9a939..712e903c6b 100644--- a/frontend/appflowy_web_app/src/application/services/js-services/cache/index.ts+++ b/frontend/appflowy_web_app/src/application/services/js-services/cache/index.ts@@ -12,7 +12,7 @@ import {import { applyYDoc } from '@/application/ydoc/apply';import { closeCollabDB, db, openCollabDB } from '@/application/db';import { Fetcher, StrategyType } from '@/application/services/js-services/cache/types';-import { IndexeddbPersistence } from 'y-indexeddb';+// import { IndexeddbPersistence } from 'y-indexeddb';import * as Y from 'yjs';export function collabTypeToDBType(type: CollabType) {@@ -139,19 +139,19 @@ export async function getPublishView<const doc = await openCollabDB(name);const rowMapDoc = (await openCollabDB(`${name}_rows`)) as Y.Doc;- const subdocs = Array.from(rowMapDoc.getSubdocs());-- for (const subdoc of subdocs) {- const promise = new Promise((resolve) => {- const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);-- persistence.on('synced', () => {- resolve(true);- });- });-- await promise;- }+ // const subdocs = Array.from(rowMapDoc.getSubdocs());+ //+ // for (const subdoc of subdocs) {+ // const promise = new Promise((resolve) => {+ // const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);+ //+ // persistence.on('synced', () => {+ // resolve(true);+ // });+ // });+ //+ // await promise;+ // }const exist = (await hasViewMetaCache(name)) && hasCollabCache(doc);@@ -245,14 +245,21 @@ export async function revalidatePublishView<const subdoc = new Y.Doc({guid: key,});- const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);- persistence.on('synced', () => {- applyYDoc(subdoc, new Uint8Array(value));- rowMapDoc.getMap().delete(subdoc.guid);- rowMapDoc.getMap().set(subdoc.guid, subdoc);- });+ applyYDoc(subdoc, new Uint8Array(value));+ rowMapDoc.getMap().delete(subdoc.guid);+ rowMapDoc.getMap().set(subdoc.guid, subdoc);++ // const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);+ //+ // persistence.on('synced', () => {+ // applyYDoc(subdoc, new Uint8Array(value));+ // rowMapDoc.getMap().delete(subdoc.guid);+ // rowMapDoc.getMap().set(subdoc.guid, subdoc);+ // });}++ console.log('rows', rows);}const state = new Uint8Array(data);@@ -268,15 +275,15 @@ export async function deleteView(name: string) {console.log('deleteView', name);await deleteViewMeta(name);await closeCollabDB(name);- const rowMapDoc = (await openCollabDB(`${name}_rows`)) as Y.Doc;-- const subdocs = Array.from(rowMapDoc.getSubdocs());-- for (const subdoc of subdocs) {- const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);-- await persistence.destroy();- }+ // const rowMapDoc = (await openCollabDB(`${name}_rows`)) as Y.Doc;+ //+ // const subdocs = Array.from(rowMapDoc.getSubdocs());+ //+ // for (const subdoc of subdocs) {+ // const persistence = new IndexeddbPersistence(subdoc.guid, subdoc);+ //+ // await persistence.destroy();+ // }await closeCollabDB(`${name}_rows`);}diff --git a/frontend/appflowy_web_app/src/application/services/js-services/index.ts b/frontend/appflowy_web_app/src/application/services/js-services/index.tsindex 42675d88dc..7ac7cbc256 100644--- a/frontend/appflowy_web_app/src/application/services/js-services/index.ts+++ b/frontend/appflowy_web_app/src/application/services/js-services/index.ts@@ -38,6 +38,8 @@ export class AFClientService implements AFService {private cacheDatabaseRowDocMap: Map<string, Y.Doc> = new Map();+ private cacheDatabaseRowFolder: Map<string, Y.Map<YDoc>> = new Map();+constructor(config: AFServiceConfig) {initAPIService({...config.cloudConfig,@@ -122,11 +124,18 @@ export class AFClientService implements AFService {return Promise.reject(new Error('Root rows doc not found'));}- const rowsFolder: Y.Map<YDoc> = rootRowsDoc.getMap();+ if (!this.cacheDatabaseRowFolder.has(name)) {+ const rowsFolder: Y.Map<YDoc> = rootRowsDoc.getMap();++ this.cacheDatabaseRowFolder.set(name, rowsFolder);+ }++ const rowsFolder = this.cacheDatabaseRowFolder.get(name)!;return {rows: rowsFolder,destroy: () => {+ this.cacheDatabaseRowFolder.delete(name);this.cacheDatabaseRowDocMap.delete(name);},};