From a08f4e3bd13f718e50908e2e450c1d0b324d14e1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 25 May 2021 05:30:57 -0700 Subject: [PATCH] Fix controlled component warning Mm right, when we first render the output, `imageUrl` is `undefined`, so the output textbox renders with `value={undefined}`, which is an "uncontrolled" component that the DOM is free to change. In practice, this isn't an issue because the textbox has `isReadOnly`, so the user can't _actually_ change it. But it's still a good idea for consistency and clarity to use an empty string instead of `undefined`, and it removes warning spam from my console! --- src/app/OutfitUrlsPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/OutfitUrlsPage.js b/src/app/OutfitUrlsPage.js index b339450..1526b9c 100644 --- a/src/app/OutfitUrlsPage.js +++ b/src/app/OutfitUrlsPage.js @@ -156,7 +156,7 @@ function SingleImageConverter() { } ); - const imageUrl = data?.outfit?.imageUrl; + const imageUrl = data?.outfit?.imageUrl || ""; const previewBackground = useColorModeValue("gray.200", "whiteAlpha.300"); const spinnerSize = useBreakpointValue({ base: "md", md: "sm" });