Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter field crashes undefined #432

Merged
merged 1 commit into from
Feb 7, 2025

Conversation

kaladay
Copy link

@kaladay kaladay commented Jan 31, 2025

Description

The filterField() crashes on undefined when the find() returns no results.
The view.utility.ts has this block of code:

const getFilterField = (collectionView: CollectionView, actualFilter: Filter): string => {
  return collectionView.facets.find(f => f.field === actualFilter.field).name;
};

That code assumes that the facet will always have a correct find.
So, it has a NULL/undefined error when .name is not found.
Then the entire page/site crashes and is unusable when this happens.

An easy fix is just to use the ?. instead of ..

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Testing Procedures

Manual inspection and testing.

…ults.

The `view.utility.ts` has this block of code:
```
const getFilterField = (collectionView: CollectionView, actualFilter: Filter): string => {
  return collectionView.facets.find(f => f.field === actualFilter.field).name;
};
```

That code assumes that the facet will always have a correct find.
So, it has a NULL/undefined error when .name is not found.
Then the entire page/site crashes and is unusable when this happens.

An easy fix is just to use the `?.` instead of `.`.
@wwtamu wwtamu changed the base branch from main to tamu-main January 31, 2025 16:02
@wwtamu wwtamu changed the base branch from tamu-main to sprint10-staging February 6, 2025 14:58
@wwtamu wwtamu marked this pull request as ready for review February 6, 2025 14:58
@wwtamu wwtamu requested a review from Dbreck-TAMU February 6, 2025 15:00
@kaladay kaladay merged commit 01888b1 into sprint10-staging Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants