Skip to content

Commit 75215e3

Browse files
authored
🐛 修复调试脚本时getValue获取旧值
1 parent d0c664f commit 75215e3

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

src/apps/script/controller.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -376,8 +376,16 @@ export class ScriptController {
376376
});
377377
}
378378

379-
public saveValue(script: Script, key: string, val: any): Promise<Value | undefined> {
380-
return this.updateValue(key, val, script.id, (script.metadata['storagename'] && script.metadata['storagename'][0] || undefined));
379+
public async saveValue(script: Script, key: string, val: any): Promise<Value | undefined> {
380+
const storageName = script.metadata?.storagename?.[0]
381+
// 无缓存字段时
382+
if (!storageName) {
383+
return
384+
}
385+
const model = await this.updateValue(key, val, script.id, storageName);
386+
// 清空storagename的缓存数据,触发getScriptValue方法重新同步一次数据
387+
await App.Cache.remove('value:storagename:' + storageName)
388+
return model
381389
}
382390

383391
public deleteValue(script: Script, key: string): Promise<void> {

0 commit comments

Comments
 (0)