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/admin/federation/import-export/form.jsx | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

(limited to 'web/source/settings/admin/federation/import-export/form.jsx')

diff --git a/web/source/settings/admin/federation/import-export/form.jsx b/web/source/settings/admin/federation/import-export/form.jsx
index afd2d775d..7b6ad9206 100644
--- a/web/source/settings/admin/federation/import-export/form.jsx
+++ b/web/source/settings/admin/federation/import-export/form.jsx
@@ -36,13 +36,11 @@ const ExportFormatTable = require("./export-format-table");
 module.exports = function ImportExportForm({ form, submitParse, parseResult }) {
 	const [submitExport, exportResult] = useFormSubmit(form, query.useExportDomainListMutation());
 
-	const [updateFromFile, setUpdateFromFile] = React.useState(false);
-
 	function fileChanged(e) {
 		const reader = new FileReader();
 		reader.onload = function (read) {
-			form.domains.setter(read.target.result);
-			setUpdateFromFile(true);
+			form.domains.value = read.target.result;
+			submitParse();
 		};
 		reader.readAsText(e.target.files[0]);
 	}
@@ -54,10 +52,6 @@ module.exports = function ImportExportForm({ form, submitParse, parseResult }) {
 		/* eslint-disable-next-line react-hooks/exhaustive-deps */
 	}, [exportResult]);
 
-	if (updateFromFile) {
-		setUpdateFromFile(false);
-		submitParse();
-	}
 	return (
 		<>
 			<h1>Import / Export suspended domains</h1>
-- 
cgit v1.2.3

