use the correct interface for process callers since backend returns references and print errors to the console in boundary fallback

This commit is contained in:
jasquat 2023-09-22 17:02:58 -04:00
parent 6463a7461f
commit 3a94db8a2e
3 changed files with 10 additions and 8 deletions

View File

@ -12,6 +12,9 @@ export function ErrorBoundaryFallback({ error }: ErrorProps) {
// This is displayed if the ErrorBoundary catches an error when rendering the form. // This is displayed if the ErrorBoundary catches an error when rendering the form.
const { resetBoundary } = useErrorBoundary(); const { resetBoundary } = useErrorBoundary();
// print the error to the console so we can debug issues
console.error(error);
return ( return (
<Notification <Notification
title="Something Went Wrong." title="Something Went Wrong."

View File

@ -64,7 +64,7 @@ import {
modifyProcessIdentifierForPathParam, modifyProcessIdentifierForPathParam,
} from '../helpers'; } from '../helpers';
import { useUriListForPermissions } from '../hooks/UriListForPermissions'; import { useUriListForPermissions } from '../hooks/UriListForPermissions';
import { PermissionsToCheck, ProcessModelCaller, Task } from '../interfaces'; import { PermissionsToCheck, ProcessReference, Task } from '../interfaces';
import { usePermissionFetcher } from '../hooks/PermissionService'; import { usePermissionFetcher } from '../hooks/PermissionService';
type OwnProps = { type OwnProps = {
@ -89,7 +89,7 @@ type OwnProps = {
onSearchProcessModels?: (..._args: any[]) => any; onSearchProcessModels?: (..._args: any[]) => any;
onElementsChanged?: (..._args: any[]) => any; onElementsChanged?: (..._args: any[]) => any;
url?: string; url?: string;
callers?: ProcessModelCaller[]; callers?: ProcessReference[];
activeUserElement?: React.ReactElement; activeUserElement?: React.ReactElement;
}; };
@ -628,17 +628,17 @@ export default function ReactDiagramEditor({
passiveModal passiveModal
> >
<UnorderedList> <UnorderedList>
{callers.map((ref: ProcessModelCaller) => ( {callers.map((ref: ProcessReference) => (
<li> <li>
<Link <Link
size="lg" size="lg"
href={`/process-models/${modifyProcessIdentifierForPathParam( href={`/process-models/${modifyProcessIdentifierForPathParam(
ref.process_model_id ref.relative_location
)}`} )}`}
> >
{`${ref.display_name}`} {`${ref.display_name}`}
</Link>{' '} </Link>{' '}
({ref.process_model_id}) ({ref.relative_location})
</li> </li>
))} ))}
</UnorderedList> </UnorderedList>

View File

@ -43,7 +43,6 @@ import {
CarbonComboBoxProcessSelection, CarbonComboBoxProcessSelection,
ProcessFile, ProcessFile,
ProcessModel, ProcessModel,
ProcessModelCaller,
ProcessReference, ProcessReference,
} from '../interfaces'; } from '../interfaces';
import ProcessSearch from '../components/ProcessSearch'; import ProcessSearch from '../components/ProcessSearch';
@ -136,7 +135,7 @@ export default function ProcessModelEditDiagram() {
const processModelPath = `process-models/${modifiedProcessModelId}`; const processModelPath = `process-models/${modifiedProcessModelId}`;
const [callers, setCallers] = useState<ProcessModelCaller[]>([]); const [callers, setCallers] = useState<ProcessReference[]>([]);
usePrompt('Changes you made may not be saved.', diagramHasChanges); usePrompt('Changes you made may not be saved.', diagramHasChanges);