pulsar-edit / package-frontend

Frontend Site for Browsing Packages
https://web.pulsar-edit.dev/
MIT License
13 stars 8 forks source link

Pagination goes weird when there are no matches for a search #104

Closed savetheclocktower closed 1 year ago

savetheclocktower commented 1 year ago

Thanks in advance for your bug report!

Where is the URL that this occurs?

https://web.pulsar-edit.dev/packages/search?q=afjdkslfjdsk

What's your issue?

When there are no results to display, the pagination widget reports Showing 1 to 0 of NaN entries.

Which OS/Browser/Version does this happen on?

All.

Steps to Reproduce/Additional Details:

Mash your keyboard in the search field and hit Enter.

savetheclocktower commented 1 year ago

Ideal outcome here, I think, would be to hide both pagination widgets and show a “No Results” blank slate view.

confused-Techie commented 1 year ago

Thanks a ton for reporting this, I'll try taking a look into it, to see if this is an issue with the backend or frontend.

Since absolutely the frontend should ensure that doesn't happen and things like NaN are the frontend's fault, I also want to make sure the backend isn't returning bad data causing this

confused-Techie commented 1 year ago

So checking on this, seems the backend is submitting some bad data here when the search leaves zero results.

Specifically:

Link: "undefined"
Query-Total: "undefined"
Query-Limit: "undefined"

So this issue will likely need changes in both locations to resolve this one

confused-Techie commented 1 year ago

So I just wanted to mention, thought further review, this error is not of the fault of the frontend.

We can see for example during the package viewing, if there are no results the pagination still has valid values. So this issue is only applicable on this one endpoint.

savetheclocktower commented 1 year ago

I've still got a UI quibble about showing the pagination at all in that scenario. It's not like Showing 1 to 0 of 0 entries makes much more sense than Showing 1 to 0 of NaN entries.

I fully realize how insignificant this issue is.

confused-Techie commented 1 year ago

@savetheclocktower No that's still a valid point.

So you think showing a static message, such as No packages found or This request doesn't match any packages makes more sense? Or of course we can go with the static No Results return

savetheclocktower commented 1 year ago

Yeah, I'd just hide the pagination altogether and show a static message.

confused-Techie commented 1 year ago

@savetheclocktower What do you think of this? image

savetheclocktower commented 1 year ago

Works for me.