microsoft-search / pnp-modern-search

Home of PnP Modern Search solutions, helping you move from classic to modern SharePoint and beyond
https://microsoft-search.github.io/pnp-modern-search
Other
379 stars 336 forks source link

Download button disappears when selecting items and going from one page to another #3871

Closed samu11 closed 8 hours ago

samu11 commented 1 month ago

Follow the template below or we will have to delete this request!!

Version used Ex: 4.12.1

Describe the bug In the PnP Search Results web part, when we select items to download across multiple pages, the download button disappears. The browser console shows the error: "Cannot read properties of undefined (reading 'SPWebUUrl')." For example, if I select items on page 1, then move to page 2 and select more items, and then move to page 3, the Download button disappears. When I navigate back to page 2, the Download button reappears but only downloads the items selected on page 2, not those on page 1. This behavior occurs whether we navigate sequentially (e.g., pages 1, 2, 3) or jump between pages (e.g., from page 1 to page 11, then to page 13). The issue is consistent across both custom and out-of-the-box layouts. Sometimes you already see the button disappeared on page 3 but sometimes you have to go to page 4 or 5 before it disappears.

To Reproduce Detailed steps to reproduce the behavior:

  1. Configure the search results webpart to show desired results
  2. Follow steps here 'https://www.patrikhellgren.com/blog/how-to-use-the-pnp-modern-search-download-feature/' to enable downloading
  3. Select items on page 1 and move to page 2 by clicking number 2 at the bottom
  4. Select items on page 2 and move to page 3 by clicking number 3 at the bottom (Download button disappears at this point and shows above mentioned error in console)
  5. Move back to page 2 by clicking number 2 at the bottm (Download button reappear)
  6. Click download (It only downloads the item on current page)

Expected behavior The Download button should not disappear when navigating forward or backward with items selected, and it should download all the selected items.

Screenshots Here is page 3 of the search results, where we can see the download button. At this moment, I have selected only one item. image

Below is page 3 of the search results, where the download button has disappeared. I have selected multiple items on pages 1, 2, and 3. image

Desktop (please complete the following information):

Additional context The provided pictures are not consistent, as the search results change each time I try it. I have observed the same behavior across two different tenants and in different browsers, both in incognito mode and regular mode to avoid cache interference.

wobba commented 1 month ago

@patrikhellgren to take a look.

samu11 commented 1 week ago

Hi @wobba I wanted to ask if work has already begun on this issue. Thank you in advance.

patrikhellgren commented 1 week ago

@samu11 I just submitted a fix for this (#3954). Just to be clear, you can only download items from the current page. This is by design since the results layout only knows about the items on the current page and because of this the download button cannot know anything about the selected items on other pages.

samu11 commented 6 days ago

@patrikhellgren Thank you for your valuable input and assistance.

wobba commented 8 hours ago

Closing as by design