清理缓存

This commit is contained in:
pengyuthon
2026-05-13 08:50:43 +08:00
parent 3ff79263fe
commit 252cd3594d
@@ -5,7 +5,7 @@ import { patch } from "@web/core/utils/patch";
import { deepCopy } from "@web/core/utils/objects";
import { useService } from "@web/core/utils/hooks";
import { url } from "@web/core/utils/urls";
import { clickRefreshButton} from "../actions/client_actions";
import { clickRefreshButton } from "../actions/client_actions";
const WKF_NOTIFY_TYPE = 'wkf_notify'
@@ -17,10 +17,11 @@ patch(NavBar.prototype, {
this.audio.src = this.audio.canPlayType("audio/ogg; codecs=vorbis")
? url("/mail/static/src/audio/ting.ogg")
: url("/mail/static/src/audio/ting.mp3");
const clearCache = () => this.env.bus.trigger("CLEAR-CACHES");
const play = () => {
return this.audio.play()
.then(() => {
clearCache()
clickRefreshButton()
})
.catch((e) => {
@@ -28,13 +29,13 @@ patch(NavBar.prototype, {
});
}
/**
* 监听后端发送的信号,重新加载菜单数据
* 监听后端发送的信号,重新加载菜单数据,清除viewSevice的缓存
* 1. 通知类型为WKF_NOTIFY_TYPE时,直接刷新菜单播放音频
* 2. 其余则通过菜单badge_count对比
*/
this.busService.subscribe("sun_badge_menu.reload_menu_data", (detail) => {
console.log('[sun_badge_menu.reload_menu_data]重新加载数据...')
debugger
// debugger
for (const d of detail) {
if (d?.type === WKF_NOTIFY_TYPE) {
this.menuService.reload();
@@ -48,7 +49,7 @@ patch(NavBar.prototype, {
return value ? value.reduce((count, app) => count + (app?.badge_count || 0), 0) : 0;
}
browser.setTimeout(() => {
debugger
// debugger
const oldCount = getReduceCount(oldMenuApps)
const newMenuApps = this.menuService.getApps()
const newCount = getReduceCount(newMenuApps)