Commit ee41ec51 authored by Dimitrios Gogos's avatar Dimitrios Gogos
Browse files

fix: update unavailable state initialization to handle null values for better loading behavior

parent 20ea2c4c
Loading
Loading
Loading
Loading
+1 −1
Changes for portal-gui/src/features/api-clients/api-clients.tsx: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ export function ApiClientsPage() {
    <>
      <PageHeader
        actions={
          !unavailable && (
          unavailable === false && (
            <Button onClick={() => setCreating(true)}>
              <Plus className="mr-2 h-4 w-4" />
              Create API client
+2 −1
Changes for portal-gui/src/hooks/useApiClients.ts: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -11,7 +11,8 @@ export function useApiClients() {
  const [loading, setLoading] = useState(true);
  const [error, setError] = useState(false);
  // 404: this deployment has no API clients (the backend isn't set up for them).
  const [unavailable, setUnavailable] = useState(false);
  // null until the first answer, so the page doesn't act on a guess.
  const [unavailable, setUnavailable] = useState<boolean | null>(null);
  const [reloadKey, setReloadKey] = useState(0);

  useEffect(() => {