smol cleanup

This commit is contained in:
stfrigerio 2025-04-05 17:56:01 +02:00
parent ad87e0e851
commit e892ce9d9c
2 changed files with 0 additions and 7 deletions

View file

@ -43,7 +43,5 @@ export async function upsertBooleanValue(instance: UpsertBooleanComponentInstanc
console.error(`[UpsertBooleanValue ${instance.habitKey}] Failed to upsert data:`, error);
instance.showErrorState("Save Error - DB");
new Notice(`Error saving switch state for ${instance.habitKey}`);
//? Optional: Revert display on error?
// instance._updateDisplay(instance.currentValue);
}
}

View file

@ -10,14 +10,9 @@ export type ChangeEventHandler = (event: Event) => void;
/** Creates the handler for the checkbox's 'change' event. */
export function createChangeHandler(instance: BooleanSwitchInstance): ChangeEventHandler {
return (event: Event) => {
//? We don't actually need the event target's value,
//? the component's _updateData method will flip the *current* state.
instance._updateData().catch(err => {
//? Error logging, specific handling is inside _updateData
console.error(`[BooleanSwitchChangeHandler ${instance.habitKey}] Error during update:`, err);
//? Consider reverting the checkbox state visually if update fails? Requires more complex state management.
if (event.target instanceof HTMLInputElement) {
// Example: Revert visual state - CAUTION: might fight with error state UI
event.target.checked = !event.target.checked;
}
});