Skip to content
This repository has been archived by the owner on Jan 19, 2025. It is now read-only.

Commit

Permalink
fix(gui): is:done filter crashes app (#943)
Browse files Browse the repository at this point in the history
* fix(gui): `is:done` filter crashes app

* style: apply automatic fixes of linters

Co-authored-by: lars-reimann <[email protected]>
  • Loading branch information
lars-reimann and lars-reimann authored Jul 8, 2022
1 parent f5bb873 commit 92c93dc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
8 changes: 6 additions & 2 deletions api-editor/gui/src/features/filter/model/DoneFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,17 @@ export class DoneFilter extends AbstractPythonFilter {

private getAnnotationsForTarget(target: string, annotationStore: AnnotationStore): Annotation[] {
return Object.entries(annotationStore).flatMap(([key, value]) => {
if (typeof value !== 'object') {
return [];
}

if (!(target in value)) {
return [];
}

if (key === 'calledAfters' || key === 'groups') {
if (key === 'calledAfterAnnotations' || key === 'groupAnnotations') {
return Object.values(value[target]);
} else if (key === 'completes') {
} else if (key === 'completeAnnotations') {
return [];
} else {
return [value[target]];
Expand Down
5 changes: 2 additions & 3 deletions api-editor/gui/src/features/menuBar/MenuBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ import { useLocation, useNavigate } from 'react-router-dom';
import { SelectionBreadcrumbs } from './SelectionBreadcrumbs';
import { HelpMenu } from './HelpMenu';
import { AnnotationStore } from '../annotations/versioning/AnnotationStoreV2';
import { supportedAnnotationStoreSchemaVersions } from '../annotations/versioning/expectedVersions';
import { EXPECTED_ANNOTATION_STORE_SCHEMA_VERSION } from '../annotations/versioning/expectedVersions';

interface MenuBarProps {
displayInferErrors: (errors: string[]) => void;
Expand Down Expand Up @@ -99,8 +99,7 @@ export const MenuBar: React.FC<MenuBarProps> = function ({ displayInferErrors })
JSON.stringify(
{
...annotationStore,
schemaVersion:
supportedAnnotationStoreSchemaVersions[supportedAnnotationStoreSchemaVersions.length - 1],
schemaVersion: EXPECTED_ANNOTATION_STORE_SCHEMA_VERSION,
},
null,
4,
Expand Down

0 comments on commit 92c93dc

Please sign in to comment.