Skip to content

Commit

Permalink
fix scroll data
Browse files Browse the repository at this point in the history
  • Loading branch information
silicia-apps committed Jan 30, 2024
1 parent 302f333 commit 7f71922
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 9 deletions.
2 changes: 1 addition & 1 deletion apps/demo/src/app/database/database.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export class DatabasePageComponent {
) {
this.taskState.setDatabaseId('demo');
this.taskState.setCollectionId('tasks');
this.taskState.load([Query.limit(100)]);
this.taskState.load([Query.limit(50)]);
}

public async create() {
Expand Down
10 changes: 2 additions & 8 deletions libs/database/src/lib/store/database.state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,14 +71,8 @@ export abstract class SioDatabaseState<
if (collectionId) this.setCollectionId(collectionId);
if (queries) this.setQueries(queries);
if (this.snapshot.databaseId && this.snapshot.collectionId) {
let queries: string[] = [];
if (this.snapshot.queries) {
const { ...get_queries } = this.snapshot.queries;
queries = get_queries;
if (this.snapshot.remoteIndex)
queries.push(
Query.cursorAfter(this.snapshot.remoteIndex as string),
);
if (this.snapshot.remoteIndex) queries= [...this.snapshot.queries,Query.cursorAfter(this.snapshot.remoteIndex as string), ]
}
const documents = <SioDatabaseDocumentListInterface<T>>(
await this.sioDatabaseService.query(
Expand All @@ -88,13 +82,13 @@ export abstract class SioDatabaseState<
)
);
if (this.snapshot.remoteIndex) {
console.error(documents.documents)
this.addEntitiesMany(documents.documents);
} else {
this.setEntitiesMany(documents.documents);
}
this.setRemoteTotals(documents.total);
this.setLocalTotals(this.snapshot.ids.length);
console.error(documents.documents.pop()!.$id!);
this.setRemoteIndex(documents.documents.pop()!.$id!);
}
return true;
Expand Down

0 comments on commit 7f71922

Please sign in to comment.