From 471c9cd21de3433acb0382151409db5ee02bdc19 Mon Sep 17 00:00:00 2001
From: Jorik Schellekens <joriksch@gmail.com>
Date: Sun, 13 Sep 2020 18:02:18 +0100
Subject: [PATCH] Fix empty array not falsy bug

---
 src/components/LinkPreview.tsx | 2 +-
 src/components/UserPreview.tsx | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/components/LinkPreview.tsx b/src/components/LinkPreview.tsx
index 4d0b9da..511d3ac 100644
--- a/src/components/LinkPreview.tsx
+++ b/src/components/LinkPreview.tsx
@@ -120,7 +120,7 @@ const LinkPreview: React.FC<IProps> = ({ link }: IProps) => {
 
     const hses = useHSs(link);
 
-    if (!hses) {
+    if (!hses.length) {
         content = (
             <>
                 <DefaultPreview link={link} />
diff --git a/src/components/UserPreview.tsx b/src/components/UserPreview.tsx
index af9a440..0a88e6a 100644
--- a/src/components/UserPreview.tsx
+++ b/src/components/UserPreview.tsx
@@ -77,7 +77,7 @@ export const WrappedInviterPreview: React.FC<WrappedInviterProps> = ({
     const [user, setUser] = useState<User | undefined>(undefined);
     const hss = useHSs(link);
     useEffect(() => {
-        if (hss) {
+        if (hss.length) {
             client(hss[0])
                 .then((c) => getUserDetails(c, link.identifier))
                 .then(setUser)
-- 
GitLab