diff --git a/src/main/frontend/app/components/directory-picker/directory-picker.tsx b/src/main/frontend/app/components/directory-picker/directory-picker.tsx index c23a2835..e67ad15b 100644 --- a/src/main/frontend/app/components/directory-picker/directory-picker.tsx +++ b/src/main/frontend/app/components/directory-picker/directory-picker.tsx @@ -40,11 +40,11 @@ export default function DirectoryPicker({ setEntries(result.entries) setCurrentPath(result.resolvedPath) setParentPath(result.parentPath) - } catch (error_) { - if (error_ instanceof ApiError && error_.status === 403) { + } catch (error) { + if (error instanceof ApiError && error.httpCode === 403) { setError('Access denied') } else { - setError(error_ instanceof Error ? error_.message : 'Failed to load directories') + setError(error instanceof Error ? error.message : 'Failed to load directories') } } finally { setLoading(false) diff --git a/src/main/frontend/app/components/file-structure/editor-data-provider.ts b/src/main/frontend/app/components/file-structure/editor-data-provider.ts index 7e028cb1..2b8371ec 100644 --- a/src/main/frontend/app/components/file-structure/editor-data-provider.ts +++ b/src/main/frontend/app/components/file-structure/editor-data-provider.ts @@ -1,6 +1,7 @@ import type { TreeItem, TreeItemIndex } from 'react-complex-tree' import type { FileTreeNode } from '~/types/filesystem.types' import { fetchProjectRootTree, fetchDirectoryByPath } from '~/services/file-tree-service' +import { logApiError } from '~/utils/logger' import { sortChildren } from './tree-utilities' import type { DataProviderLike } from './use-file-tree-context-menu' import { BaseFilesDataProvider } from './base-files-data-provider' @@ -50,7 +51,7 @@ export default class EditorFilesDataProvider extends BaseFilesDataProvider(null) const theme = useTheme() diff --git a/src/main/frontend/app/providers/frankconfig-xsd-provider.tsx b/src/main/frontend/app/providers/frankconfig-xsd-provider.tsx index e17759cb..8294f02f 100644 --- a/src/main/frontend/app/providers/frankconfig-xsd-provider.tsx +++ b/src/main/frontend/app/providers/frankconfig-xsd-provider.tsx @@ -1,5 +1,6 @@ import { createContext, useContext, useEffect, useState, type ReactNode } from 'react' import { fetchFrankConfigXsd } from '~/services/xsd-service' +import { logApiWarning } from '~/utils/logger' interface FrankConfigXsdContextValue { xsdContent: string | null @@ -13,7 +14,7 @@ export function FrankConfigXsdProvider({ children }: { children: ReactNode }) { useEffect(() => { fetchFrankConfigXsd() .then(setXsdContent) - .catch((error) => console.error('Failed to load FrankConfig XSD:', error)) + .catch((error) => logApiWarning('Failed to load FrankConfig XSD:', error as Error)) }, []) return {children} diff --git a/src/main/frontend/app/routes/datamapper/property-list.tsx b/src/main/frontend/app/routes/datamapper/property-list.tsx index 0523cfb6..ad212005 100644 --- a/src/main/frontend/app/routes/datamapper/property-list.tsx +++ b/src/main/frontend/app/routes/datamapper/property-list.tsx @@ -156,9 +156,10 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { setEditingMapping, openMapping, }) - //Don't add flow as dependancy here, it'll become an infinite loop flow changes every rerender --> updates the memo --> the memo updates the nodetypes --> updating the nodetypes causes react to trigger a rerender resulting in a infinite loop + //UseMemo is used here to ensure nodetype is not changed throughout rerenders. If the variable is updated reactflow throws a warning in the console; + //Don't add flow as dependency here, it'll become an infinite loop flow changes every rerender --> updates the memo --> the memo updates the nodetypes --> updating the nodetypes causes react to trigger a rerender resulting in a infinite loop // eslint-disable-next-line react-hooks/exhaustive-deps - }, [openMapping]) //UseMemo is used here to ensure nodetype is not changed throughout rerenders. If the variable is updated reactflow throws a warning in the console; + }, [openMapping]) useEffect(() => { if (!reactFlowInstance) return @@ -171,7 +172,6 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { window.addEventListener('resize', updateSize) - // delay initial run requestAnimationFrame(updateSize) return () => { @@ -189,14 +189,13 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { }) }, [reactFlowNodes, edges, reactFlowInstance, configDispatch]) - //Updates the outer canvas whenever something is added useEffect(() => { setCanvasSize((size) => updateCanvasSize(reactFlowNodes, size)) }, [reactFlowNodes]) const onRestore = useCallback(() => { const restoreFlow = async () => { - if (config.propertyData) await flow.importJsonConfiguration(JSON.stringify(config.propertyData)) + if (config.propertyData) flow.importJsonConfiguration(JSON.stringify(config.propertyData)) } restoreFlow().then(() => { @@ -258,8 +257,8 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { ) function openMappingModal(sources: NodeLabels[], targets: NodeLabels[]) { - setMappingSources(sources.filter((s) => s.id?.includes('item'))) - setMappingTargets(targets.filter((t) => t.id?.includes('item'))) + setMappingSources(sources.filter((source) => source.id?.includes('item'))) + setMappingTargets(targets.filter((target) => target.id?.includes('item'))) setAddMappingModal(true) } @@ -286,7 +285,7 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { } setEditingNode(null) setAddFieldModal(false) - showSuccessToast('Added property succesfully!') + showSuccessToast('Added property successfully') } catch (error) { if (error instanceof Error) { showErrorToast(error.message) @@ -307,7 +306,7 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) { setEdges(updatedEdges) setEditingMapping(null) setAddMappingModal(false) - showSuccessToast('Added mapping succesfully!') + showSuccessToast('Added mapping successfully') setReactFlowNodes((previous) => previous.map((node) => ({ ...node, @@ -343,10 +342,7 @@ function PropertyList({ config, configDispatch }: PropertyListProperties) {
-
+
({ diff --git a/src/main/frontend/app/routes/datamapper/root.tsx b/src/main/frontend/app/routes/datamapper/root.tsx index c43a041f..32f4bb9b 100644 --- a/src/main/frontend/app/routes/datamapper/root.tsx +++ b/src/main/frontend/app/routes/datamapper/root.tsx @@ -75,8 +75,8 @@ export default function Root() {