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!
This commit is contained in:
Emi Matchu 2021-11-30 16:51:20 -08:00
parent e95f6abbe4
commit 29d44c10bd

View file

@ -566,7 +566,7 @@ function ItemPageWantButton({ itemId, isChecked }) {
<VisuallyHidden
as="input"
type="checkbox"
isChecked={isChecked}
checked={isChecked}
onChange={(e) => {
if (e.target.checked) {
sendAddMutation().catch((e) => {