fix: add platform abstraction for deeplink #251
@@ -56,10 +56,16 @@ function DeepLinkNavigationListener() {
|
||||
const navigate = useNavigate();
|
||||
|
|
||||
|
||||
useEffect(() => {
|
||||
window.electronDeepLink.getPending().then((path) => {
|
||||
platform.deepLink
|
||||
.getPending()
|
||||
.then((path) => {
|
||||
if (path) navigate(path);
|
||||
})
|
||||
.catch((err) => {
|
||||
logError(err, { scope: 'deepLink.getPending' });
|
||||
});
|
||||
return window.electronDeepLink.onNavigate((path) => navigate(path));
|
||||
|
||||
return platform.deepLink.onNavigate((path) => navigate(path));
|
||||
}, [navigate]);
|
||||
|
||||
return null;
|
||||
|
||||
@@ -30,8 +30,7 @@ export default function NetworkRoot() {
|
||||
setSearchParams(
|
||||
(prev) => {
|
||||
const params = new URLSearchParams(prev);
|
||||
if (next === 'open') params.delete('status');
|
||||
else params.set('status', next);
|
||||
params.set('status', next);
|
||||
return params;
|
||||
},
|
||||
{ replace: true },
|
||||
@@ -56,7 +55,6 @@ export default function NetworkRoot() {
|
||||
|
||||
return (
|
||||
<div className="relative flex min-h-0 flex-1 flex-col">
|
||||
{/* Top bar — stays in place */}
|
||||
<div className="flex shrink-0 items-center p-1 border-b">
|
||||
<Tabs
|
||||
value={statusTab}
|
||||
@@ -75,7 +73,6 @@ export default function NetworkRoot() {
|
||||
</Tabs>
|
||||
</div>
|
||||
|
||||
{/* Scrollable content */}
|
||||
<div className="min-h-0 flex-1 overflow-y-auto overscroll-contain pb-14 py-2">
|
||||
<ParticleListView
|
||||
streams={streams}
|
||||
|
||||
@@ -55,4 +55,9 @@ export const electronPlatform: Platform = {
|
||||
setDockBadge: (count) => window.electronApp.setDockBadge(count),
|
||||
getVersion: () => window.electronApp.getVersion(),
|
||||
},
|
||||
|
||||
deepLink: {
|
||||
getPending: () => window.electronDeepLink.getPending(),
|
||||
onNavigate: (cb) => window.electronDeepLink.onNavigate(cb),
|
||||
},
|
||||
};
|
||||
|
||||
@@ -60,6 +60,11 @@ export interface Platform {
|
||||
setDockBadge: (count: number) => void;
|
||||
getVersion: () => Promise<string>;
|
||||
};
|
||||
|
||||
deepLink: {
|
||||
getPending: () => Promise<string | null>;
|
||||
onNavigate: (callback: (path: string) => void) => () => void;
|
||||
};
|
||||
}
|
||||
|
||||
export const DESKTOP_DOWNLOAD_URL = 'https://flowylabs.ai/llink/download';
|
||||
|
||||
@@ -117,4 +117,11 @@ export const webPlatform: Platform = {
|
||||
setDockBadge: applyDockBadge,
|
||||
getVersion: async () => __APP_VERSION__,
|
||||
},
|
||||
|
||||
deepLink: {
|
||||
getPending: () => Promise.resolve(null),
|
||||
onNavigate: (_) => {
|
||||
return () => {};
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user
⚠️ Potential issue | 🟠 Major | ⚡ Quick win
Add error handling for
getPending()promise.The
getPending()call has no error handler. If the underlying Electron IPC or platform implementation throws or rejects, this will result in an unhandled promise rejection that could crash the app or surface console errors.🛡️ Proposed fix to add error handling
📝 Committable suggestion
🤖 Prompt for AI Agents
✅ Addressed in commit
5275f38Shouldn't your fix use either reportError or logError?
🧩 Analysis chain
🏁 Script executed:
Length of output: 397
🏁 Script executed:
Length of output: 28070
@talksik— you're right. The codebase has a clear distinction injs/desktop/src/lib/errors.ts:logError— "Expected-but-recordable failures. Breadcrumb only — never pages anyone." (dev-only console output)reportError— "Unexpected failures the user may not see. Always captured." (always sent to the observability sink)For
getPending(), a rejection is recoverable (navigation simply doesn't happen) and low-impact, which fitslogError's contract. This also matches the pattern used for similar call-site errors likeautoplay.beepandsoundEffects.preload. Updated suggestion:That said, if the team treats any IPC rejection as unexpected (similar to how
ipc-utils.tsusesreportErrorfor IPC handler errors on the main-process side),reportErrorwould also be justified. The call is yours based on the severity convention you want to apply here.@coderabbitai help