mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 08:12:26 -05:00 
			
		
		
		
	[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
This commit is contained in:
		
					parent
					
						
							
								0a9874329d
							
						
					
				
			
			
				commit
				
					
						47daddc10c
					
				
			
		
					 19 changed files with 153 additions and 86 deletions
				
			
		|  | @ -20,15 +20,16 @@ | |||
| 
 | ||||
| const React = require("react"); | ||||
| 
 | ||||
| module.exports = function useBoolInput({ name, Name }, { defaultValue = false } = {}) { | ||||
| 	const [value, setValue] = React.useState(defaultValue); | ||||
| const _default = false; | ||||
| module.exports = function useBoolInput({ name, Name }, { initialValue = _default }) { | ||||
| 	const [value, setValue] = React.useState(initialValue); | ||||
| 
 | ||||
| 	function onChange(e) { | ||||
| 		setValue(e.target.checked); | ||||
| 	} | ||||
| 
 | ||||
| 	function reset() { | ||||
| 		setValue(defaultValue); | ||||
| 		setValue(initialValue); | ||||
| 	} | ||||
| 
 | ||||
| 	// Array / Object hybrid, for easier access in different contexts | ||||
|  | @ -45,6 +46,7 @@ module.exports = function useBoolInput({ name, Name }, { defaultValue = false } | |||
| 		reset, | ||||
| 		value, | ||||
| 		setter: setValue, | ||||
| 		hasChanged: () => value != defaultValue | ||||
| 		hasChanged: () => value != initialValue, | ||||
| 		_default | ||||
| 	}); | ||||
| }; | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue