update file workf

This commit is contained in:
Weixuan Fu
2024-02-25 22:13:22 +08:00
parent fe5cf26134
commit 79a1fa127f
3 changed files with 8 additions and 6 deletions
+1 -2
View File
@@ -176,7 +176,7 @@ export default function App() {
const checkIsDirty = async () => {
if (curFlowID.current != null) {
const curWorkflow = await workflowsTable?.get(curFlowID.current);
const curWorkflow = await workflowsTable?.get(curFlowID.current, false);
return !!curWorkflow && checkIsDirtyImpl(curWorkflow);
}
return false;
@@ -391,7 +391,6 @@ export default function App() {
graphAppSetup();
setLoadChild(true);
autoSaveTimer.current = setInterval(async () => {
return;
const autoSaveEnabled =
(await userSettingsTable?.getSetting("autoSave")) ?? true;
+1 -1
View File
@@ -76,7 +76,7 @@ export namespace TwowaySyncAPI {
const absPath = sanitizeAbsPath(
`${myWorkflowsDir}/${parentFolderID ?? ""}/${name}.json`,
);
console.log("get abs path 🔥 workfoow", absPath);
console.warn("get abs path 🔥 workfoow", absPath);
try {
const response = await fetch("/workspace/get_workflow_file", {
method: "POST",
+6 -3
View File
@@ -48,7 +48,7 @@ export class WorkflowsTable extends TableBase<Workflow> {
*/
public async latestVersionCheck() {
if (this._curWorkflow) {
const curFlowInDB = await this.get(this._curWorkflow.id);
const curFlowInDB = await indexdb.workflows.get(this._curWorkflow.id);
if (curFlowInDB) {
return curFlowInDB?.updateTime === this._curWorkflow.updateTime;
}
@@ -263,10 +263,13 @@ export class WorkflowsTable extends TableBase<Workflow> {
return sortFileItem(all, sortBy ?? ESortTypes.RECENTLY_MODIFIED);
}
public async get(id: string): Promise<Workflow | undefined> {
public async get(
id: string,
needJsonContent = true, //if false, only get the meta info from indexdb
): Promise<Workflow | undefined> {
const twoWaySyncEnabled = await userSettingsTable?.getSetting("twoWaySync");
const wf = await indexdb.workflows.get(id);
if (!twoWaySyncEnabled) {
if (!twoWaySyncEnabled || !needJsonContent) {
return wf;
}
// two way sync mode