优化:避免重复请求排钻模板数据

pull/1570/MERGE
ChenX 3 years ago
parent 506d3de539
commit f110130991

@ -1,18 +1,18 @@
import { observable, toJS, action } from "mobx"; import { Intent } from "@blueprintjs/core";
import { action, observable, toJS } from "mobx";
import { appCache } from "../../Common/AppCache";
import { CheckObjectType, CheckoutValid } from "../../Common/CheckoutVaildValue"; import { CheckObjectType, CheckoutValid } from "../../Common/CheckoutVaildValue";
import { DataAdapter } from "../../Common/DataAdapter"; import { DataAdapter } from "../../Common/DataAdapter";
import { DirUrl, TemplateUrls } from "../../Common/HostUrl";
import { DirectoryId, PostJson, RequestStatus } from "../../Common/Request";
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo, inflate } from "../../Common/SerializeMaterial";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { userConfig } from "../../Editor/UserConfig";
import { IConfigOption, IExportConfigData } from "../Components/Board/UserConfig"; import { IConfigOption, IExportConfigData } from "../Components/Board/UserConfig";
import { AppToaster } from "../Components/Toaster";
import { BoardStore } from "./BoardStore"; import { BoardStore } from "./BoardStore";
import { DrillingOption, SpacingType } from "./drillInterface"; import { DrillingOption, SpacingType } from "./drillInterface";
import { userConfig } from "../../Editor/UserConfig";
import { AppToaster } from "../Components/Toaster";
import { Intent } from "@blueprintjs/core";
import { StoreageKeys } from "../../Common/StoreageKeys";
import { ExtrudeHole } from "../../DatabaseServices/3DSolid/ExtrudeHole";
import { DirectoryId, PostJson, RequestStatus } from "../../Common/Request";
import { DirUrl, TemplateUrls } from "../../Common/HostUrl";
import { deflate, EntitysIn, EntitysOut, GetEntitysLogo, inflate } from "../../Common/SerializeMaterial";
import { appCache } from "../../Common/AppCache";
export interface IExportDrillOption export interface IExportDrillOption
@ -280,9 +280,14 @@ export class DrillStore extends BoardStore
} }
} }
} }
private _Cacheed = new Set<string>();//避免重复缓存
async CacheDrillTemp(conf: DrillingOption) async CacheDrillTemp(conf: DrillingOption)
{ {
let tempId = conf.tempId; let tempId = conf.tempId;
if (this._Cacheed.has(tempId)) return;
this._Cacheed.add(tempId);
let key = StoreageKeys.DrillTemp + tempId; let key = StoreageKeys.DrillTemp + tempId;
if (appCache.has(key + "name")) if (appCache.has(key + "name"))
conf.tempName = appCache.get(key + "name"); conf.tempName = appCache.get(key + "name");

Loading…
Cancel
Save