Skip to content

Commit

Permalink
[fix] incorrect noMore state of Repository model (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
hu-qi authored Jun 9, 2024
1 parent 4d057a6 commit 1c69709
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion models/Repository.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { githubClient, RepositoryModel, UserModel } from 'mobx-github';
import {
githubClient,
RepositoryFilter,
RepositoryModel,
UserModel,
} from 'mobx-github';
import { parseCookie } from 'mobx-i18n';
import { toggle } from 'mobx-restful';

Expand Down Expand Up @@ -41,6 +46,32 @@ export class GitRepositoryModel extends RepositoryModel {
);
return body!;
}

async loadNewPage(
pageIndex: number,
pageSize: number,
filter: RepositoryFilter,
) {
const { pageData, totalCount } = await this.loadPage(
pageIndex,
pageSize,
filter,
);
this.pageSize = pageSize;

const list = [...this.pageList];
list[pageIndex - 1] = pageData;
this.pageList = list;

this.totalCount =
totalCount != null
? isNaN(totalCount) || totalCount < 0
? Infinity
: totalCount
: Infinity;

return { pageData, totalCount };
}
}

export const userStore = new UserModel();
Expand Down

1 comment on commit 1c69709

@github-actions
Copy link

@github-actions github-actions bot commented on 1c69709 Jun 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploy preview for oss-toolbox ready!

✅ Preview
https://oss-toolbox-4rudsnhtd-techquerys-projects.vercel.app

Built with commit 1c69709.
This pull request is being automatically deployed with vercel-action

Please sign in to comment.