fix: admin/config: focus mime's first column, press tab and the non-empty row was removed

Massimo Melina committed May 27, 2022 at 14:27 UTC 4c89faa6a9c0dadd6bc5a5897541ba2594e3b0fd
2 files changed +5 -2
admin/src/Form.ts
+5 -1
@@ -206,6 +206,7 @@ export function StringField({ value, onChange, typing, start, end, ...props }: F
206 const [state, setState] = useState(setter)
207
208 useEffect(() => setState(setter), [value]) //eslint-disable-line
209 + let lastChange = value
210 return h(TextField, {
211 fullWidth: true,
212 InputLabelProps: state || props.placeholder ? { shrink: true } : undefined,
@@ -236,7 +237,10 @@ export function StringField({ value, onChange, typing, start, end, ...props }: F
237 })
238
239 function go(event: any, val: string=state) {
239 - onChange(val.trim(), {
240 + const newV = val.trim()
241 + if (newV === lastChange) return // don't compare to 'value' as that represents only accepted changes, while we are interested also in changes through discarded values
242 + lastChange = newV
243 + onChange(newV, {
244 was: value,
245 event,
246 cancel() {
admin/src/HomePage.ts
-1
@@ -38,7 +38,6 @@ export default function HomePage() {
38 " or ",
39 SOLUTION_SEP, cfgLink("provide adequate files")
40 ]]))
41 - console.log(plugins)
41 return h(Box, { display:'flex', gap: 2, flexDirection:'column' },
42 username && entry('', "Welcome "+username),
43 errors.length ? dontBotherWithKeys(errors.map(msg => entry('error', dontBotherWithKeys(msg))))