diff --git a/apps/router/src/components/Header.tsx b/apps/router/src/components/Header.tsx
index c13a4662b..4f1ff4b00 100644
--- a/apps/router/src/components/Header.tsx
+++ b/apps/router/src/components/Header.tsx
@@ -7,11 +7,12 @@ import { useAppContext } from '../context/hooks';
export const Header = React.memo(function Header() {
const { guardians, gateways } = useAppContext();
- const { type, id } = useActiveService();
- const activeService = useMemo(() => {
+ const activeService = useActiveService();
+ const activeServiceInfo = useMemo(() => {
+ if (!activeService) return null;
const serviceMap = { guardian: guardians, gateway: gateways };
- return serviceMap[type]?.[id] ?? null;
- }, [type, id, guardians, gateways]);
+ return serviceMap[activeService.type]?.[activeService.id] ?? null;
+ }, [activeService, guardians, gateways]);
const hasServices =
Object.keys(guardians).length > 0 || Object.keys(gateways).length > 0;
@@ -25,16 +26,16 @@ export const Header = React.memo(function Header() {
{hasServices && (
- {activeService && (
+ {activeService && activeServiceInfo && (
- {type === 'guardian' ? 'Guardian' : 'Gateway'}:{' '}
- {activeService.config.baseUrl}
+ {activeService.type === 'guardian' ? 'Guardian' : 'Gateway'}:{' '}
+ {activeServiceInfo?.config.baseUrl}
)}
)}
diff --git a/apps/router/src/components/ServiceMenu.tsx b/apps/router/src/components/ServiceMenu.tsx
index 14dc2799a..d3693fad1 100644
--- a/apps/router/src/components/ServiceMenu.tsx
+++ b/apps/router/src/components/ServiceMenu.tsx
@@ -14,7 +14,7 @@ import { ServiceType, ServiceConfig } from '../types';
type ServiceMenuProps = {
guardians: Record;
gateways: Record;
- activeServiceId: string | null;
+ activeServiceId: string | undefined;
};
export const ServiceMenu: React.FC = ({
diff --git a/apps/router/src/hooks/index.tsx b/apps/router/src/hooks/index.tsx
index 73524d831..50b9cd069 100644
--- a/apps/router/src/hooks/index.tsx
+++ b/apps/router/src/hooks/index.tsx
@@ -3,12 +3,14 @@ import { useLocation } from 'react-router-dom';
export const useActiveService = (): {
type: 'guardian' | 'gateway';
id: string;
-} => {
+} | null => {
const location = useLocation();
const [type, id] = location.pathname.split('/').filter(Boolean);
- if (type !== 'guardian' && type !== 'gateway') {
- throw new Error('Invalid service type');
+
+ if (!type || !id || (type !== 'guardian' && type !== 'gateway')) {
+ return null;
}
+
return {
type,
id,
diff --git a/flake.lock b/flake.lock
index 3c2aa5981..963e495b9 100644
--- a/flake.lock
+++ b/flake.lock
@@ -3,11 +3,11 @@
"advisory-db": {
"flake": false,
"locked": {
- "lastModified": 1723840407,
- "narHash": "sha256-AZI593yLh4lcKJdAnnjyLMKUm5PMDpFy1APIYFURLyI=",
+ "lastModified": 1720458342,
+ "narHash": "sha256-H8HeiVq7P3VEPxU0MUwh13xlcg0VXvKP5SQ37fs3QOs=",
"owner": "rustsec",
"repo": "advisory-db",
- "rev": "201638b35a3e85b7794e84cc73f876d7a2b7ad51",
+ "rev": "502a1ba73728791a73e8b94cee6406ab79ec8ba5",
"type": "github"
},
"original": {
@@ -19,7 +19,7 @@
"android-nixpkgs": {
"inputs": {
"devshell": "devshell",
- "flake-utils": "flake-utils_4",
+ "flake-utils": "flake-utils_3",
"nixpkgs": [
"fedimint",
"flakebox",
@@ -87,20 +87,20 @@
},
"devshell": {
"inputs": {
- "flake-utils": "flake-utils_3",
"nixpkgs": [
"fedimint",
"flakebox",
"android-nixpkgs",
"nixpkgs"
- ]
+ ],
+ "systems": "systems_2"
},
"locked": {
- "lastModified": 1717408969,
- "narHash": "sha256-Q0OEFqe35fZbbRPPRdrjTUUChKVhhWXz3T9ZSKmaoVY=",
+ "lastModified": 1695195896,
+ "narHash": "sha256-pq9q7YsGXnQzJFkR5284TmxrLNFc0wo4NQ/a5E93CQU=",
"owner": "numtide",
"repo": "devshell",
- "rev": "1ebbe68d57457c8cae98145410b164b5477761f4",
+ "rev": "05d40d17bf3459606316e3e9ec683b784ff28f16",
"type": "github"
},
"original": {
@@ -119,17 +119,17 @@
"nixpkgs": "nixpkgs_4"
},
"locked": {
- "lastModified": 1725636462,
- "narHash": "sha256-vMQh5Y3Mkx5fZnwPyv2aIF9XftCPxnpjtkuMjx+wHhk=",
+ "lastModified": 1726518111,
+ "narHash": "sha256-ih1ZwH8uItplMJU2/XkQseFlYUsf8/TkX8lGyRl7/KU=",
"owner": "fedimint",
"repo": "fedimint",
- "rev": "1697e61c1214e4a68aeabf23bb25e9eaa1fa991d",
+ "rev": "63a01dd4551157d40f559a5d38bc451db9d362dd",
"type": "github"
},
"original": {
"owner": "fedimint",
"repo": "fedimint",
- "rev": "1697e61c1214e4a68aeabf23bb25e9eaa1fa991d",
+ "rev": "63a01dd4551157d40f559a5d38bc451db9d362dd",
"type": "github"
}
},
@@ -142,11 +142,11 @@
"rust-analyzer-src": "rust-analyzer-src"
},
"locked": {
- "lastModified": 1724049063,
- "narHash": "sha256-aTnh9Ar40OaT2MTULeJMR9EIrylKeKUYWP61QEZBu0Q=",
+ "lastModified": 1719015507,
+ "narHash": "sha256-Fi9voHxBDWyKpvD2SJA9ARSMYSZg/atD9x7nkYr/ELw=",
"owner": "nix-community",
"repo": "fenix",
- "rev": "94c18bf5acb3966b07cc863bd00f4f959c0c5ec4",
+ "rev": "261936e5e770489369ecdd664647908a8ae5cab6",
"type": "github"
},
"original": {
@@ -189,33 +189,15 @@
}
},
"flake-utils_3": {
- "inputs": {
- "systems": "systems_2"
- },
- "locked": {
- "lastModified": 1701680307,
- "narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
- "owner": "numtide",
- "repo": "flake-utils",
- "rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
- "type": "github"
- },
- "original": {
- "owner": "numtide",
- "repo": "flake-utils",
- "type": "github"
- }
- },
- "flake-utils_4": {
"inputs": {
"systems": "systems_3"
},
"locked": {
- "lastModified": 1710146030,
- "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+ "lastModified": 1694529238,
+ "narHash": "sha256-zsNZZGTGnMOf9YpHKJqMSsa0dXbfmxeoJ7xHlrt+xmY=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+ "rev": "ff7b65b44d01cf9ba6a71320833626af21126384",
"type": "github"
},
"original": {
@@ -224,7 +206,7 @@
"type": "github"
}
},
- "flake-utils_5": {
+ "flake-utils_4": {
"inputs": {
"systems": [
"fedimint",
@@ -246,16 +228,16 @@
"type": "github"
}
},
- "flake-utils_6": {
+ "flake-utils_5": {
"inputs": {
"systems": "systems_5"
},
"locked": {
- "lastModified": 1710146030,
- "narHash": "sha256-SZ5L6eA7HJ/nmkzGG7/ISclqe6oZdOZTNoesiInkXPQ=",
+ "lastModified": 1726560853,
+ "narHash": "sha256-X6rJYSESBVr3hBoH0WbKE5KvhPU5bloyZ2L4K60/fPQ=",
"owner": "numtide",
"repo": "flake-utils",
- "rev": "b1d9ab70662946ef0850d488da1c9019f3a9752a",
+ "rev": "c1dfcf08411b08f6b8615f7d8971a2bfa81d5e8a",
"type": "github"
},
"original": {
@@ -272,7 +254,7 @@
"fedimint",
"fenix"
],
- "flake-utils": "flake-utils_5",
+ "flake-utils": "flake-utils_4",
"nixpkgs": [
"fedimint",
"nixpkgs"
@@ -377,11 +359,11 @@
},
"nixpkgs_4": {
"locked": {
- "lastModified": 1723938990,
- "narHash": "sha256-9tUadhnZQbWIiYVXH8ncfGXGvkNq3Hag4RCBEMUk7MI=",
+ "lastModified": 1718835956,
+ "narHash": "sha256-wM9v2yIxClRYsGHut5vHICZTK7xdrUGfrLkXvSuv6s4=",
"owner": "nixos",
"repo": "nixpkgs",
- "rev": "c42fcfbdfeae23e68fc520f9182dde9f38ad1890",
+ "rev": "dd457de7e08c6d06789b1f5b88fc9327f4d96309",
"type": "github"
},
"original": {
@@ -394,17 +376,17 @@
"root": {
"inputs": {
"fedimint": "fedimint",
- "flake-utils": "flake-utils_6"
+ "flake-utils": "flake-utils_5"
}
},
"rust-analyzer-src": {
"flake": false,
"locked": {
- "lastModified": 1723915239,
- "narHash": "sha256-x/RXN/ougJ1IEoBKrY0UijB530OfOfICK4KPa3Kj9Bk=",
+ "lastModified": 1718888342,
+ "narHash": "sha256-fzdX+mapnBrex5biWA6Q/Be4mDfm0q1r/N4SL1qIq6k=",
"owner": "rust-lang",
"repo": "rust-analyzer",
- "rev": "fa003262474185fd62168379500fe906b331824b",
+ "rev": "67f7eb505e3aaf37db4bc805c79c95f9be44e2a5",
"type": "github"
},
"original": {
diff --git a/flake.nix b/flake.nix
index 02632c160..42f371f5f 100644
--- a/flake.nix
+++ b/flake.nix
@@ -2,9 +2,9 @@
inputs = {
flake-utils.url = "github:numtide/flake-utils";
fedimint = {
- # master on 2024-09-06
+ # v0.4.2
url =
- "github:fedimint/fedimint?rev=1697e61c1214e4a68aeabf23bb25e9eaa1fa991d";
+ "github:fedimint/fedimint?rev=63a01dd4551157d40f559a5d38bc451db9d362dd";
};
};
outputs = { self, flake-utils, fedimint }: