NCIOCPL / clinical-trials-listing-app

React Application for listing clinical trials
3 stars 1 forks source link

Redirect to noTrials from a non-existent page is broken #141

Closed kate-mashkina closed 2 years ago

kate-mashkina commented 2 years ago

Issue description

Description of the issue

When Api returns an empty trials array it should redirect to noTrials- currently App just breaks

The fix needs to include Acceptance Test

    Given "trialListingPageType" is set to "Disease"
        And "dynamicListingPatterns" object is set to "Disease"
        Given the user navigates to "/breast-cancer?cfg=0&pn=900"
        Then the user is redirected to "/notrials" with query parameters "p1=breast-cancer"

ESTIMATE TBD

Steps to reproduce the issue

  1. go to https://react-app-dev.cancer.gov/clinical-trials-listing-app/develop/breast-cancer?cfg=0&pn=900
  2. see the error

What's the expected result?

-it should navigate to /notrials?p1=breast-cancer

What's the actual result?

Additional details / screenshot

Related Tickets

alerosad commented 2 years ago

I got it working, however, I have my code based on the error message that the api sends back when you ask for a non existent page. The error message looks like this:

Trial count mismatch from the API

This works for any page up to page 2000, however, after page 2000 like page 2001 or 3000 or whichever (http://localhost:3000/lung-cancer?cfg=0&pn=2001) I receive this:

POST http://localhost:3000/cts/proxy-api/v2/trials 400 (Bad Request)

So it seems like the API doesn't handle requests well past that 2000 page request. Should I change my implementation of the noTrials redirect or is this something that should be fixed on the API's end?

alerosad commented 2 years ago

@kate-mashkina

alinai commented 2 years ago

@kate-mashkina, @sarinapadilla, Verified the following for MLP, DLP (Disease and Intervention):

  1. For MLP: We get same result both on Prod and React App with page number (pn)> last page number but pn<2001. It takes us to the page with: "There are currently no available trials.".
  2. For Diseases and Interventions: -Verified when the user navigates to /breast-cancer?cfg=0&pn=900, the user is redirected to "/notrials" with query parameters "p1=breast-cancer"
    • Verified that c-codes are redirected to pretty urls
    • Verified that with page number (pn) > the last page number we are redirected to no trials page -Verified that the redirection to no trials page and Page Not Found works as expected with invalid C-Codes (C1234) or terms (spiroplatin) and other redirections to no trials page (/notrials?p1=C123455&cfg=1) works as expected
    • Verified that when we change the 'pn=number' query param of the URL, nothing else changes in the url except the page number while paging through
    • Verified when we change 'pn=number' param manually, the page is loaded accordingly and the same number is highlighted on the pager as the one entered in the url
alinai commented 2 years ago

@sarinapadilla , Noticed that for pn> 2000, react displays the following error for DLP. Prod also displays the same error for pn>2000 but the title and delighter is not displayed in Prod but is displayed in React. image image

For MLP, the React gives the following error for pn>2000: image

But Prod gives different error for pn>2000:

image

sarinapadilla commented 2 years ago

This issue was fixed by #144 , so closing this ticket.