mirror of
				https://github.com/superseriousbusiness/gotosocial.git
				synced 2025-10-31 03:22:24 -05:00 
			
		
		
		
	[chore] Settings refactor fix4 (#1383)
* fix error handling behavior in emoji overview and FormWithData components * css: long domain cutoff * unused require * eslint vscode task
This commit is contained in:
		
					parent
					
						
							
								36f62d6e60
							
						
					
				
			
			
				commit
				
					
						27d4e364e0
					
				
			
		
					 7 changed files with 36 additions and 16 deletions
				
			
		|  | @ -19,13 +19,14 @@ | |||
| "use strict"; | ||||
| 
 | ||||
| const React = require("react"); | ||||
| const { Error } = require("../../components/error"); | ||||
| 
 | ||||
| const Loading = require("../../components/loading"); | ||||
| 
 | ||||
| // Wrap Form component inside component that fires the RTK Query call, | ||||
| // so Form will only be rendered when data is available to generate form-fields for | ||||
| module.exports = function FormWithData({ dataQuery, DataForm, queryArg, ...formProps }) { | ||||
| 	const { data, isLoading } = dataQuery(queryArg); | ||||
| 	const { data, isLoading, isError, error } = dataQuery(queryArg); | ||||
| 
 | ||||
| 	if (isLoading) { | ||||
| 		return ( | ||||
|  | @ -33,6 +34,10 @@ module.exports = function FormWithData({ dataQuery, DataForm, queryArg, ...formP | |||
| 				<Loading /> | ||||
| 			</div> | ||||
| 		); | ||||
| 	} else if (isError) { | ||||
| 		return ( | ||||
| 			<Error error={error} /> | ||||
| 		); | ||||
| 	} else { | ||||
| 		return <DataForm data={data} {...formProps} />; | ||||
| 	} | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue