From 29d44c10bd7cf2d21971b251b01ace8bd4b9c737 Mon Sep 17 00:00:00 2001 From: Matchu Date: Tue, 30 Nov 2021 16:51:20 -0800 Subject: [PATCH] Fix double-click bug unchecking own/want an item Oops, I used the wrong property to control the checkbox state! This made it an uncontrolled component. It would always start unchecked when the page loads, regardless of actual own/want state, and then toggle based on physical clicks. This meant that things generally worked correctly if you didn't own/want the item when you first loaded the page; but if you already did, then you would click once and send an *add* mutation instead of a remove; and then click again and be able to remove. Now, removes only take one click! --- src/app/ItemPage.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app/ItemPage.js b/src/app/ItemPage.js index 206f8f8..daca92c 100644 --- a/src/app/ItemPage.js +++ b/src/app/ItemPage.js @@ -566,7 +566,7 @@ function ItemPageWantButton({ itemId, isChecked }) { { if (e.target.checked) { sendAddMutation().catch((e) => {