From 8ea33cc0819aad3f1939d827f9e47db4d0635743 Mon Sep 17 00:00:00 2001 From: Hunter Miller Date: Fri, 3 Sep 2021 18:31:38 -0500 Subject: [PATCH] hash: fixing vat missing issue --- pkg/grid/src/nav/SystemMenu.tsx | 26 ++++++++++++++------------ pkg/grid/src/state/kiln.ts | 4 ++-- 2 files changed, 16 insertions(+), 14 deletions(-) diff --git a/pkg/grid/src/nav/SystemMenu.tsx b/pkg/grid/src/nav/SystemMenu.tsx index 7f5a53ebb..e42c8f25a 100644 --- a/pkg/grid/src/nav/SystemMenu.tsx +++ b/pkg/grid/src/nav/SystemMenu.tsx @@ -24,7 +24,7 @@ export const SystemMenu = ({ className, menu, open, navOpen }: SystemMenuProps) const { push } = useHistory(); const [copied, setCopied] = useState(false); const garden = useVat('garden'); - const hash = getHash(garden); + const hash = garden ? getHash(garden) : null; const copyHash = useCallback((event: Event) => { event.preventDefault(); @@ -107,17 +107,19 @@ export const SystemMenu = ({ className, menu, open, navOpen }: SystemMenuProps) About Landscape - - Base Hash - - {!copied && {hash}} - {copied && 'copied!'} - - + {hash && ( + + Base Hash + + {!copied && {hash}} + {copied && 'copied!'} + + + )} diff --git a/pkg/grid/src/state/kiln.ts b/pkg/grid/src/state/kiln.ts index 7e9b1973b..d5513167d 100644 --- a/pkg/grid/src/state/kiln.ts +++ b/pkg/grid/src/state/kiln.ts @@ -1,4 +1,4 @@ -import { getVats, Vats, scryLag, getBlockers } from '@urbit/api'; +import { getVats, Vats, scryLag, getBlockers, Vat } from '@urbit/api'; import create from 'zustand'; import produce from 'immer'; import { useCallback } from 'react'; @@ -44,7 +44,7 @@ export function useBlockers() { return useKilnState(selBlockers); } -export function useVat(desk: string) { +export function useVat(desk: string): Vat | undefined { return useKilnState(useCallback((s) => s.vats[desk], [desk])); }