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

Search issue 361 #380

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Search issue 361 #380

wants to merge 2 commits into from

Conversation

taoliu12
Copy link
Contributor

@taoliu12 taoliu12 commented Oct 14, 2023

This fixes the linked issues regarding the search error when database is not migrated.

Dev Summary

Mocks

Test Plan

repro steps:

  1. localhost:3000
  2. click X button
    expected:

Resources

@@ -51,7 +51,7 @@ type Props = {
function AssetsList(props: Props): JSX.Element {
const { classes } = useStyles();
const { assets, headerContentRight, headerText } = props;
if (!assets) return <> </>;
if (!assets || !Array.isArray(assets)) return <> No Results</>;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

assets was coming back as an error object when DB is unseeded, so I added a check for if it is an array.

Copy link
Contributor

@esteban-gs esteban-gs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks fine to me, maybe safer to do a nullish check like:

{assets && assets.map(...

Looking into this, it seems that the server returning a 500 error should be handled in the fetch call. Right now that fetch call isn't catching any errors.

function fetchSearchData() {

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.

Fix bug with /api/assets?type=request&search= Fix bug in /search-results?category=Offers
2 participants