Skip to content

Commit

Permalink
fix(renderer-app,web): pan list result incorrect when file number mor…
Browse files Browse the repository at this point in the history
…e then 50 (#1299)
  • Loading branch information
BlackHole1 committed Jan 15, 2022
1 parent 6cad8cf commit f3a38c3
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { post } from "./utils";

export interface ListFilesPayload {
page: number;
order: "ASC" | "DESC";
}
interface ListFilesResponse {
totalUsage: number;
Expand Down
5 changes: 4 additions & 1 deletion desktop/renderer-app/src/pages/CloudStoragePage/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ export class CloudStorageStore extends CloudStorageStoreBase {
this.clearRefreshFilesNowTimeout();

try {
const { totalUsage, files: cloudFiles } = await listFiles({ page: 1 });
const { totalUsage, files: cloudFiles } = await listFiles({
page: 1,
order: "DESC",
});

runInAction(() => {
this.totalUsage = totalUsage;
Expand Down
5 changes: 4 additions & 1 deletion desktop/renderer-app/src/utils/drag-and-drop/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export async function onDropImage(file: File, x: number, y: number, room: Room):
const getSize = getImageSize(file);
const task = new UploadTask(file);
await task.upload();
const { files } = await listFiles({ page: 1 });
const { files } = await listFiles({
page: 1,
order: "DESC",
});
const cloudFile = files.find(f => f.fileUUID === task.fileUUID);

hideLoading();
Expand Down
1 change: 1 addition & 0 deletions web/flat-web/src/api-middleware/flatServer/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { post } from "./utils";

export interface ListFilesPayload {
page: number;
order: "ASC" | "DESC";
}
interface ListFilesResponse {
totalUsage: number;
Expand Down
5 changes: 4 additions & 1 deletion web/flat-web/src/pages/CloudStoragePage/store.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,10 @@ export class CloudStorageStore extends CloudStorageStoreBase {
this.clearRefreshFilesNowTimeout();

try {
const { totalUsage, files: cloudFiles } = await listFiles({ page: 1 });
const { totalUsage, files: cloudFiles } = await listFiles({
page: 1,
order: "DESC",
});

runInAction(() => {
this.totalUsage = totalUsage;
Expand Down
5 changes: 4 additions & 1 deletion web/flat-web/src/utils/drag-and-drop/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ export async function onDropImage(file: File, x: number, y: number, room: Room):
const getSize = getImageSize(file);
const task = new UploadTask(file);
await task.upload();
const { files } = await listFiles({ page: 1 });
const { files } = await listFiles({
page: 1,
order: "DESC",
});
const cloudFile = files.find(f => f.fileUUID === task.fileUUID);

hideLoading();
Expand Down

0 comments on commit f3a38c3

Please sign in to comment.