TF-4274 Avoid clearing all caches on refresh for non‑web platforms

This commit is contained in:
dab246
2026-01-28 16:42:53 +07:00
committed by Dat H. Pham
parent 4d77018027
commit 18d9a47431
6 changed files with 21 additions and 15 deletions
@@ -611,14 +611,16 @@ class MailboxDashBoardController extends ReloadableController
@override
Future<void> onBeforeUnloadBrowserListener(html.Event event) async {
log('MailboxDashBoardController::onBeforeUnloadBrowserListener:event = ${event.runtimeType} | hasComposer = ${twakeAppManager.hasComposer} | isExecutingBeforeReconnect = ${twakeAppManager.isExecutingBeforeReconnect}');
if (PlatformInfo.isWeb) {
await cachingManager.clearAllEmailAndStateCache();
final shouldPrevent = event is html.BeforeUnloadEvent &&
twakeAppManager.hasComposer &&
!twakeAppManager.isExecutingBeforeReconnect;
if (shouldPrevent) {
event.preventDefault();
}
if (event is html.BeforeUnloadEvent &&
twakeAppManager.hasComposer &&
!twakeAppManager.isExecutingBeforeReconnect) {
event.preventDefault();
if (PlatformInfo.isWeb) {
await cachingManager.clearAllEmailAndStateCache();
}
}