diff options
author | 2023-01-25 09:47:55 +0100 | |
---|---|---|
committer | 2023-01-25 09:47:55 +0100 | |
commit | 27d4e364e04c65a11c2855eaa9a1ffc55eb23239 (patch) | |
tree | bbdde6654b6f33278ae378b7dd0345a1edc55a2e /web/source/settings/lib/form/form-with-data.jsx | |
parent | [chore] remove funky duplicate attachment in testrig (#1379) (diff) | |
download | gotosocial-27d4e364e04c65a11c2855eaa9a1ffc55eb23239.tar.xz |
[chore] Settings refactor fix4 (#1383)
* fix error handling behavior in emoji overview and FormWithData components
* css: long domain cutoff
* unused require
* eslint vscode task
Diffstat (limited to 'web/source/settings/lib/form/form-with-data.jsx')
-rw-r--r-- | web/source/settings/lib/form/form-with-data.jsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/web/source/settings/lib/form/form-with-data.jsx b/web/source/settings/lib/form/form-with-data.jsx index a383af502..d23a238bf 100644 --- a/web/source/settings/lib/form/form-with-data.jsx +++ b/web/source/settings/lib/form/form-with-data.jsx @@ -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} />; } |