Skip to content

Commit 9b4aecc

Browse files
committed
fix: 修复clearStorageSync报错的问题
1 parent c12054b commit 9b4aecc

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

packages/taro-platform-harmony-hybrid/src/api/apis/harmony-native/StorageCacheAndSyncProxy.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,16 @@ class ProxyHandler {
7878
// this.nativeApi['removeStorage']({key: key})
7979
}
8080
}
81+
if (propKey === 'clearStorageSync') {
82+
return (...args: any[]) => {
83+
// 先更新缓存,再同步原生
84+
this.cacheMap.clear()
85+
86+
args[0].fail = () => {}
87+
args[0].success = () => {}
88+
Reflect.apply(target.clearStorage, target, args)
89+
}
90+
}
8191

8292
if (propKey === 'getStorage') {
8393
return (...args: any[]) => {

0 commit comments

Comments
 (0)