mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 04:52:24 -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
				
			
		|  | @ -49,14 +49,17 @@ module.exports = function AdminSettings() { | |||
| 
 | ||||
| function AdminSettingsForm({ data: instance }) { | ||||
| 	const form = { | ||||
| 		title: useTextInput("title", { defaultValue: instance.title }), | ||||
| 		title: useTextInput("title", { | ||||
| 			source: instance, | ||||
| 			validator: (val) => val.length <= 40 ? "" : "Instance title must be 40 characters or less" | ||||
| 		}), | ||||
| 		thumbnail: useFileInput("thumbnail", { withPreview: true }), | ||||
| 		thumbnailDesc: useTextInput("thumbnail_description", { defaultValue: instance.thumbnail_description }), | ||||
| 		shortDesc: useTextInput("short_description", { defaultValue: instance.short_description }), | ||||
| 		description: useTextInput("description", { defaultValue: instance.description }), | ||||
| 		contactUser: useTextInput("contact_username", { defaultValue: instance.contact_account?.username }), | ||||
| 		contactEmail: useTextInput("contact_email", { defaultValue: instance.email }), | ||||
| 		terms: useTextInput("terms", { defaultValue: instance.terms }) | ||||
| 		thumbnailDesc: useTextInput("thumbnail_description", { source: instance }), | ||||
| 		shortDesc: useTextInput("short_description", { source: instance }), | ||||
| 		description: useTextInput("description", { source: instance }), | ||||
| 		contactUser: useTextInput("contact_username", { source: instance, valueSelector: (s) => s.contact_account?.username }), | ||||
| 		contactEmail: useTextInput("contact_email", { source: instance, valueSelector: (s) => s.email }), | ||||
| 		terms: useTextInput("terms", { source: instance }) | ||||
| 	}; | ||||
| 
 | ||||
| 	const [submitForm, result] = useFormSubmit(form, query.useUpdateInstanceMutation()); | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue