From 8f8c60d91b4edea42ee2a51b26f08355a2297a5d Mon Sep 17 00:00:00 2001 From: Matchu Date: Fri, 22 Jan 2021 14:38:37 -0800 Subject: [PATCH] Fix crash when user items page not found Huh, I'm not sure why Apollo is returning `data: undefined`, when the server is definitely returning the correct no-user-found data in the shape I expect... suspicious :/ well, let's at least stop crashing! --- src/app/UserItemsPage.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/app/UserItemsPage.js b/src/app/UserItemsPage.js index 99a57fc..9f203c4 100644 --- a/src/app/UserItemsPage.js +++ b/src/app/UserItemsPage.js @@ -97,7 +97,10 @@ function UserItemsPage() { return {error.message}; } - if (data.user == null) { + // TODO: I'm not sure why, but apparently `data` is `undefined` in the user + // not found case, even though the server is clearly returning + // `{data: {user: null}}`? That's... weird, right? :/ + if (data?.user == null) { return User not found; }