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 notification navigation (#1708)

Peter Chinmanf28961ef4e6a
diff --git a/js/app/packages/notifications/components/NotificationRoute.tsx b/js/app/packages/notifications/components/NotificationRoute.tsx
index 0657a9e3b9..ca547613e2 100644
--- a/js/app/packages/notifications/components/NotificationRoute.tsx
+++ b/js/app/packages/notifications/components/NotificationRoute.tsx
@@ -53,9 +53,14 @@ export default function NotificationRoute() {
notificationSource
).match(
() => {
- // We only use this route as a "bridge" from external navigation
- // (e.g. push tap / deep link) into the split layout.
- split.handle.close();
+ // We only use this route as a "bridge" from external navigation into the split layout.
+ // At narrowWidths, openWithSplit replaces this split in-place, so content()
+ // will have changed by the time we get here — closing would navigate
+ // away from the notification. Only close if we're still the bridge.
+ const current = split.handle.content();
+ if (current.type === 'component' && current.id === 'notification') {
+ split.handle.close();
+ }
},
(err) => {
replaceWithUnifiedList(new Error(err.tag));
diff --git a/js/app/packages/tauri/src/navigation.ts b/js/app/packages/tauri/src/navigation.ts
index af471b4e73..96c3c6ee55 100644
--- a/js/app/packages/tauri/src/navigation.ts
+++ b/js/app/packages/tauri/src/navigation.ts
@@ -9,24 +9,35 @@ type NavigateEvent = {
};
let registeredNavigate: ((path: string) => void) | null = null;
+let pendingNavigation: string | null = null;
/**
* Register a navigate function to be called from outside the router context.
* Called by useTauriNavigationEffect when the router is ready.
+ * Drains any navigation that was buffered before the router was ready.
*/
export function registerNavigate(fn: (path: string) => void) {
registeredNavigate = fn;
+ if (pendingNavigation) {
+ const path = pendingNavigation;
+ pendingNavigation = null;
+ fn(path);
+ }
}
/**
* Trigger navigation from outside the router context.
* Used by PushNotification to navigate when a notification is tapped.
+ * If the router is not yet ready, buffers the path for replay on mount.
*/
export function triggerNavigation(path: string) {
if (registeredNavigate) {
registeredNavigate(path);
} else {
- console.warn('Navigation triggered before navigate was registered');
+ console.warn(
+ `[navigation] triggerNavigation: router not ready, buffering path ${path}`
+ );
+ pendingNavigation = path;
}
}
diff --git a/js/app/tauri/Cargo.lock b/js/app/tauri/Cargo.lock
index f74ec024c4..83211a0c82 100644
--- a/js/app/tauri/Cargo.lock
+++ b/js/app/tauri/Cargo.lock
@@ -1809,7 +1809,7 @@ dependencies = [
"tokio",
"tower-service",
"tracing",
- "windows-registry 0.6.1",
+ "windows-registry",
]
[[package]]
@@ -4555,7 +4555,7 @@ dependencies = [
"thiserror 2.0.17",
"tracing",
"url",
- "windows-registry 0.5.3",
+ "windows-registry",
"windows-result 0.3.4",
]
@@ -4662,7 +4662,7 @@ dependencies = [
[[package]]
name = "tauri-plugin-notifications"
version = "0.1.0"
-source = "git+https://github.com/seanaye/tauri-plugins?branch=seanaye%2Bmnlphlp%2Fadd%2Fandroid-notifications#0c932ffd3202145b40645246d87a38deb72ba09c"
+source = "git+https://github.com/seanaye/tauri-plugins?branch=seanaye%2Bmnlphlp%2Fadd%2Fandroid-notifications#8a1be0b1efe16d8819f681c0f9939fc1ba7fe44f"
dependencies = [
"serde",
"tauri",
@@ -5941,17 +5941,6 @@ dependencies = [
"windows-strings 0.4.2",
]
-[[package]]
-name = "windows-registry"
-version = "0.6.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720"
-dependencies = [
- "windows-link 0.2.1",
- "windows-result 0.4.1",
- "windows-strings 0.5.1",
-]
-
[[package]]
name = "windows-result"
version = "0.3.4"