feat: remove getRecords;fix image duplication issue
This commit is contained in:
+5
-2
@@ -452,7 +452,7 @@ export default function App() {
|
||||
|
||||
window.addEventListener("beforeunload", handleBeforeUnload);
|
||||
|
||||
api.addEventListener("executed", (e: any) => {
|
||||
const handleExecuted = (e: any) => {
|
||||
e.detail?.output?.images?.forEach(
|
||||
(im: { filename: string; subfolder: string; type: string }) => {
|
||||
if (im.type === "output") {
|
||||
@@ -467,12 +467,15 @@ export default function App() {
|
||||
}
|
||||
},
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
api.addEventListener("executed", handleExecuted);
|
||||
return () => {
|
||||
// window.removeEventListener("message", authTokenListener);
|
||||
window.removeEventListener("keydown", shortcutListener);
|
||||
window.removeEventListener("change", fileInputListener);
|
||||
window.removeEventListener("beforeunload", handleBeforeUnload);
|
||||
window.removeEventListener("executed", handleExecuted);
|
||||
clearInterval(autoSaveTimer.current);
|
||||
};
|
||||
}, []);
|
||||
|
||||
@@ -20,21 +20,11 @@ export class ChangelogsTable extends TableBase<Changelog> {
|
||||
.equals(workflowID)
|
||||
.reverse()
|
||||
.sortBy("createTime");
|
||||
if (objects?.length) return objects;
|
||||
|
||||
const records = await this.getRecords();
|
||||
return Object.values(records)
|
||||
.filter((c) => c.workflowID === workflowID)
|
||||
.sort((a, b) => b.createTime - a.createTime);
|
||||
return objects;
|
||||
}
|
||||
public async getLastestByWorkflowID(workflowID: string): Promise<Changelog> {
|
||||
const objects = await this.listByWorkflowID(workflowID);
|
||||
if (objects?.length) return objects[0];
|
||||
const records = await this.getRecords();
|
||||
const all = Object.values(records)
|
||||
.filter((c) => c.workflowID === workflowID)
|
||||
.sort((a, b) => b.createTime - a.createTime);
|
||||
return all[0];
|
||||
return objects[0];
|
||||
}
|
||||
public async create(input: {
|
||||
json: string;
|
||||
|
||||
@@ -15,11 +15,7 @@ export class MediaTable extends TableBase<Media> {
|
||||
.equals(workflowID)
|
||||
.reverse()
|
||||
.sortBy("createTime");
|
||||
if (medias.length > 0) return medias;
|
||||
const records = await this.getRecords();
|
||||
return Object.values(records)
|
||||
.filter((c) => c.workflowID === workflowID)
|
||||
.sort((a, b) => b.createTime - a.createTime);
|
||||
return medias;
|
||||
}
|
||||
|
||||
public async create(input: {
|
||||
|
||||
Reference in New Issue
Block a user