Skip to content

Search issue 361#380

Open
taoliu12 wants to merge 2 commits intomainfrom
search-issue-361
Open

Search issue 361#380
taoliu12 wants to merge 2 commits intomainfrom
search-issue-361

Conversation

@taoliu12
Copy link
Copy Markdown
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

const { classes } = useStyles();
const { assets, headerContentRight, headerText } = props;
if (!assets) return <> </>;
if (!assets || !Array.isArray(assets)) return <> No Results</>;
Copy link
Copy Markdown
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
Copy Markdown
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