Skip to content

Commit

Permalink
delint
Browse files Browse the repository at this point in the history
  • Loading branch information
rbren committed Jan 1, 2025
1 parent 7401215 commit 5122f83
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
5 changes: 1 addition & 4 deletions frontend/src/components/layout/served-app-label.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ export function ServedAppLabel() {
<div className="flex items-center justify-between w-full">
<div className="flex items-center gap-2">App</div>
{activeHost && (
<span
onClick={openAppInNewTab}
className="flex items-center gap-2"
>
<span onClick={openAppInNewTab} className="flex items-center gap-2">
<div className="flex items-center gap-1">
<FaExternalLinkAlt fill="#a3a3a3" />
</div>
Expand Down
14 changes: 6 additions & 8 deletions frontend/src/hooks/query/use-active-host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,25 +29,23 @@ export const useActiveHost = () => {
queries: data.hosts.map((host) => ({
queryKey: [conversationId, "hosts", host],
queryFn: async () => {
console.log('querying host', host);
try {
await axios.get(host);
return host;
} catch (e) {
return '';
return "";
}
},
refetchInterval: 3000,
})),
});

const appsData = apps.map((app) => app.data);

React.useEffect(() => {
console.log('apps', apps);
const successfulApp = apps.find((app) => app.data);
console.log('successfulApp', successfulApp);
// Here's the change - use empty string as fallback instead of null
setActiveHost(successfulApp?.data || '');
}, [apps]);
const successfulApp = appsData.find((app) => app);
setActiveHost(successfulApp || "");
}, [appsData]);

return { activeHost };
};

0 comments on commit 5122f83

Please sign in to comment.