Spike: Inventory Search Results Changing and Odd Page Display

Description

Steps to repro:

  1. Log into folio-snapshot

  2. Go to Inventory

  3. Instance search results are usually ordered by title with 14 Cows for America at the top

  4. Pick an Instance

  5. Drill down to view the item record

  6. Not sure if this part is required for the repro steps, but this is what I did:

    1. Copy item barcode

    2. Go to requests

    3. Create a request for that item

  7. Go back to inventory by clicking the Inventory icon in top nav

  8. Close Item details overlay

  9. Close instance details preview pane

Expected: Should see the search results I saw initially which showed 14 cows for america at the top and a full page of results

Actual: Shows search results with Interesting times at the top and only half the page is populated with search results.

This does repro consistently.

Screencast: https://www.screencast.com/t/WDyGY6EFRoE

CSP Request Details

None

CSP Rejection Details

None

Potential Workaround

None

Attachments

1

Checklist

hide

TestRail: Results

Activity

Show:

Rasmus Wølk May 28, 2019 at 5:12 PM

I am closing this spike since we found the issue. The issue has been outlined here in the comments.

A new ticket should be created for the fix.

Michal Kuklis May 20, 2019 at 4:00 PM

I agree about the goBack. I think there are cases where goBack will work perfectly fine and others where the URL has to be built up again.

Rasmus Wølk May 20, 2019 at 3:35 PM
Edited

Thanks for the additional info .

Regarding the using history.goBack(): We have to be careful here because in some cases, the user might have entered the record (item in this case) from clicking on a shared link and not directly from the records view and in this case, I assume it would be unreliable to use history.goBack().

However, if the shared link had the filter query in the URL parameters then it would ensure that they would return back to the same results-view as the person who shared the link. If no URL parameters are applied in the URL then I guess it should return to the default query/filters. Although I think this might only apply for the results view – not when sharing an URL for e.g. an item.. (just thinking out loud at this point..)

Anyway, I think that the quickest solution for this particular issue is to preserve the URL search query when going to an item and then back to the results-view.

Michal Kuklis May 20, 2019 at 3:26 PM

I spent a bit more time reviewing this. I originally thought that the refactoring from a query resource to what react router provides for us caused this issue but this is not true. It looks like this issue existed for a long time now. There are actually two issues here.

The first one is that we don't pass the search and sort parameters in some cases (for example when we open a holding or item view).

https://github.com/folio-org/ui-inventory/blob/master/src/ItemsPerHoldingsRecord.js#L99

in order to address it we would have to do something similar to what has been done in other modules (and pass these extra params) for example in ui-users:

https://github.com/folio-org/ui-users/blob/master/src/components/ViewSections/UserLoans/UserLoans.js#L104

Another issue is that when the given layer is being closed the search and sort params are also not included in the url:

https://github.com/folio-org/ui-inventory/blob/master/src/ViewInstance.js#L134

I think in this case we could probably make the goTo a bit smarter and just lookup these search and sort params from the current url and automatically attach them to the passed url.

Also I'm wondering if perhaps in some cases we could just use history.goBack() provided by react router.

Rasmus Wølk May 20, 2019 at 2:00 PM
Edited

I found that once an item is closed it will redirect the user back to the results list like so:

.. which will clear the filters including the sorting set by the user. Filters are set as URL parameters like so: /inventory?filters=&sort=Title

To fix this, we need a way to restore the URL with sorting parameters when the item-view closes. Or we should pass the URL parameters when going to an item and pass them back when going back.

Done

Details

Assignee

Reporter

Tester Assignee

Priority

Sprint

Development Team

Stripes Force

TestRail: Cases

Open TestRail: Cases

TestRail: Runs

Open TestRail: Runs
Created March 4, 2019 at 10:09 AM
Updated May 28, 2019 at 5:12 PM
Resolved May 28, 2019 at 5:12 PM
TestRail: Cases
TestRail: Runs