diff --git a/src/components/code-snippet/code-snippet.tsx b/src/components/code-snippet/code-snippet.tsx index b1fe9d27b..75376f0bd 100644 --- a/src/components/code-snippet/code-snippet.tsx +++ b/src/components/code-snippet/code-snippet.tsx @@ -8,6 +8,7 @@ export interface CodeSnippetProps { codeProps?: CopyBlockProps; code: string; language?: 'sql' | 'bash'; + loading?: boolean; } const CopyBlock = React.lazy(() => @@ -19,21 +20,25 @@ const CopyBlock = React.lazy(() => ); export const CodeSnippet: React.FC = React.memo( - ({ className, codeProps, code, language = 'sql' }) => ( + ({ className, codeProps, code, loading, language = 'sql' }) => (
- }> - - + {loading ? ( + + ) : ( + }> + + + )}
) ); diff --git a/src/dialogs/common/import-database/import-database.tsx b/src/dialogs/common/import-database/import-database.tsx index 9d19fcc28..4c88ca5b4 100644 --- a/src/dialogs/common/import-database/import-database.tsx +++ b/src/dialogs/common/import-database/import-database.tsx @@ -71,12 +71,7 @@ export const ImportDatabase: React.FC = ({ >(); const { t } = useTranslation(); const [importMetadataScripts, setImportMetadataScripts] = - useState( - Object.values(DatabaseType).reduce((acc, val) => { - acc[val] = () => ''; - return acc; - }, {} as ImportMetadataScripts) - ); + useState(null); useEffect(() => { const loadScripts = async () => { @@ -252,19 +247,25 @@ export const ImportDatabase: React.FC = ({ ) : ( )}