From 47daddc10c291ec67320dd2485bffc498ea44bdf Mon Sep 17 00:00:00 2001
From: f0x52 <f0x@cthu.lu>
Date: Mon, 6 Feb 2023 09:19:56 +0100
Subject: [chore/frogend] Restructure form data default values / update from
 Query data (#1422)

* eslint: set console use to error to catch debug littering in CI

* remove debug logging

* some form field restructuring, fixes submitted updates not being reflected

* more form field restructuring

* remove debug logger

* simplify field updates

* fix react state set during render when submitting import file

* className instead of class

* show Select hints again
---
 web/source/settings/lib/form/radio.jsx | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

(limited to 'web/source/settings/lib/form/radio.jsx')

diff --git a/web/source/settings/lib/form/radio.jsx b/web/source/settings/lib/form/radio.jsx
index 47ab6c726..e95997474 100644
--- a/web/source/settings/lib/form/radio.jsx
+++ b/web/source/settings/lib/form/radio.jsx
@@ -20,15 +20,16 @@
 
 const React = require("react");
 
-module.exports = function useRadioInput({ name, Name }, { defaultValue, options } = {}) {
-	const [value, setValue] = React.useState(defaultValue);
+const _default = "";
+module.exports = function useRadioInput({ name, Name }, { initialValue = _default, options }) {
+	const [value, setValue] = React.useState(initialValue);
 
 	function onChange(e) {
 		setValue(e.target.value);
 	}
 
 	function reset() {
-		setValue(defaultValue);
+		setValue(initialValue);
 	}
 
 	// Array / Object hybrid, for easier access in different contexts
@@ -46,6 +47,7 @@ module.exports = function useRadioInput({ name, Name }, { defaultValue, options
 		value,
 		setter: setValue,
 		options,
-		hasChanged: () => value != defaultValue
+		hasChanged: () => value != initialValue,
+		_default
 	});
 };
\ No newline at end of file
-- 
cgit v1.2.3

