Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix[mobile]: invalidate notifications query (#1373)

Peter Chinmanfd5c22d6e88a
diff --git a/js/app/packages/app/component/Root.tsx b/js/app/packages/app/component/Root.tsx
index 0921004096..e7d67d8734 100644
--- a/js/app/packages/app/component/Root.tsx
+++ b/js/app/packages/app/component/Root.tsx
@@ -35,6 +35,7 @@ import {
prefetchUserInfo,
useUserInfoQuery,
} from '@queries/auth/user-info';
+import { invalidateUserNotifications } from '@queries/notification/user-notifications';
import { MetaProvider, Title } from '@solidjs/meta';
import {
HashRouter,
@@ -283,6 +284,18 @@ export function ConfiguredGlobalAppStateProvider(props: ParentProps) {
onNotification
);
+ if (isNativeMobilePlatform()) {
+ const onVisibilityChange = () => {
+ if (document.visibilityState === 'visible') {
+ invalidateUserNotifications();
+ }
+ };
+ document.addEventListener('visibilitychange', onVisibilityChange);
+ onCleanup(() =>
+ document.removeEventListener('visibilitychange', onVisibilityChange)
+ );
+ }
+
const blockOrchestrator = createBlockOrchestrator();
return (
diff --git a/js/app/packages/tauri/src/PushNotification.tsx b/js/app/packages/tauri/src/PushNotification.tsx
index d0c498f69d..aa692ec839 100644
--- a/js/app/packages/tauri/src/PushNotification.tsx
+++ b/js/app/packages/tauri/src/PushNotification.tsx
@@ -11,6 +11,7 @@ import {
type PlatformNotificationInterface,
PlatformNotificationProvider,
} from '@notifications';
+import { invalidateUserNotifications } from '@queries/notification/user-notifications';
import { notificationServiceClient } from '@service-notification/client';
import { makePersisted } from '@solid-primitives/storage';
import {
@@ -137,6 +138,7 @@ export function MaybePushNotificationRegistration(props: {
if (!tapped) return;
if (!notificationId) return;
+ invalidateUserNotifications();
triggerNavigation(
`/component/notification?notificationId=${notificationId}`
);