fix(badges): Remote First uncheck stuck visually checked

e.preventDefault() was called for both enable and disable clicks.
On disable, it reverted the DOM back to checked before Svelte could
sync the store update, leaving it visually stuck. Only prevent default
when enabling (to hold the unchecked state during confirmation).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Scott Idem
2026-06-09 12:15:39 -04:00
parent b6481a3507
commit 97c4c1cd6b

View File

@@ -81,13 +81,13 @@ function handle_search_trigger() {
let show_remote_first_confirm = $state(false);
function handle_remote_first_click(e: MouseEvent) {
// Always manage state manually so the checkbox never flickers mid-handler.
e.preventDefault();
const checkbox = e.currentTarget as HTMLInputElement;
if (checkbox.checked) {
// User wants to enableshow confirmation first.
// User is enabling — hold the checkbox visually unchecked until confirmed.
e.preventDefault();
show_remote_first_confirm = true;
} else {
// User is disabling — browser already toggled the DOM to unchecked; just sync the store.
badges_loc.current.qry__remote_first = false;
show_remote_first_confirm = false;
handle_search_trigger();