opentargets / issues

Issue tracker for Open Targets Platform and Open Targets Genetics Portal
https://platform.opentargets.org https://genetics.opentargets.org
Apache License 2.0
12 stars 2 forks source link

Known drugs widget disappears when searching the table #3084

Closed LucaFumis closed 6 months ago

LucaFumis commented 10 months ago

Describe the bug Issue observed in the Known Drugs widget table in profile and evidence pages. When searching the widget's table, the whole widget disappears from the page. This problem was first observed and reported by @HelenaCornu .

Observed behaviour When searching the widget's table, a set of results matching the search are displayed in the table. If however the search term is not found, the whole widget is removed from the page. The known drugs table uses server side pagination. So when searching the table, a new API request is fired. If no rows match the search term, the API returns null. The newly refactored sections in the front end check for null in order to determine which sections to display, and so at it point it removes the widget.

I need to investigate this a little further, but it might need to be fixed with help from the @opentargets/be-team: possible idea perhaps return an empty array with also the search term?

Expected behaviour When searching the known drugs table and no match is found, then the widget should display some message, e.g. "no data".

To Reproduce Steps to reproduce the behaviour:

  1. Go to a profile page, e.g. https://platform.dev.opentargets.xyz/target/ENSG00000073756
  2. Scroll down to the known drugs widget
  3. In the search box for the widget table, type something random, e.g. "asdf"
  4. See widget disappears.
buniello commented 10 months ago

We should look into this as well tomorrow

remo87 commented 10 months ago

@LucaFumis @prashantuniyal02 Would this be a valid response { "data": { "target": { "id": "ENSG00000073756", "knownDrugs": { "count": 0, "cursor": null, "rows": [], "__typename": "KnownDrugs" }, "__typename": "Target" } } }

carcruz commented 10 months ago

@LucaFumis @prashantuniyal02 Would this be a valid response { "data": { "target": { "id": "ENSG00000073756", "knownDrugs": { "count": 0, "cursor": null, "rows": [], "__typename": "KnownDrugs" }, "__typename": "Target" } } }

@remo87 yes that the expected response

raskolnikov-rodion commented 9 months ago

The widget was still disappearing after the change in the API, so I created this PR with a fix for the frontend

prashantuniyal02 commented 9 months ago

@carcruz @chinmehta

prashantuniyal02 commented 8 months ago

The search is not crashing now for the above widgets in dev platform. We should ideally fix the root cause which is handling the case when the search results are not found inside the widgets.