open-sauced / app

🍕 Insights into your entire open source ecosystem.
https://pizza.new
Apache License 2.0
414 stars 220 forks source link

Bug: Search fields redirects to 404 error page #3949

Closed Mandeep56Singh closed 4 weeks ago

Mandeep56Singh commented 1 month ago

Describe the bug

https://github.com/user-attachments/assets/b050d140-4542-4733-b42e-74cec89fe998

Steps to reproduce

  1. Go to Explore
  2. Search any repositories
  3. You will be directed to error page
github-actions[bot] commented 1 month ago

Thanks for the issue, our team will look into it as soon as possible! If you would like to work on this issue, please wait for us to decide if it's ready. The issue will be ready to work on once we remove the "needs triage" label.

To claim an issue that does not have the "needs triage" label, please leave a comment that says ".take". If you have any questions, please comment on this issue.

For full info on how to contribute, please check out our contributors guide.

adamgonzo commented 1 month ago

.take

github-actions[bot] commented 1 month ago

The issue you are trying to assign yourself is blocked until it can be triaged or by another label on the issue.

Mandeep56Singh commented 1 month ago

@adamgonzo have you checked in your system ? do you get the same issue ?

adamgonzo commented 1 month ago

@Mandeep56Singh yes i get the same issue

Mandeep56Singh commented 1 month ago

@adamgonzo I find it kinda weird that search suggest any repo in search repositories field, I should only suggest repos based on seleted topic. Like I seleted typescript then It should only suggest repos based on it. Otherwise there is no use of it. We also have search field at top which can also be used for the searching any kind of repo

adamgonzo commented 1 month ago

@Mandeep56Singh from what i understand you are saying that once you select a topic the search should only present repositories within that topic ?

Mandeep56Singh commented 1 month ago

@adamgonzo yeah, because repositories are shown based on selected topic and we are using search filed so to find the repo under that topic fast.

brandonroberts commented 1 month ago

Thanks @Mandeep56Singh @adamgonzo. The URL path should begin with /explore/topic/{topic}/... instead of /{topic}/....

adamgonzo commented 1 month ago

.take

Mandeep56Singh commented 1 month ago

hey I was also intrested in solving this issue too 😅 but no worries

Mandeep56Singh commented 1 month ago

@brandonroberts @adamgonzo I have resolved this issue

https://github.com/user-attachments/assets/3951bcc8-0012-4071-a00c-47bbb68da203

should I create a pr ?

brandonroberts commented 1 month ago

@Mandeep56Singh if @adamgonzo wants to defer to you, that's fine. They did try to pick it up initially

adamgonzo commented 1 month ago

@brandonroberts thats totally fine I won't be able to get till it till 5 pm anyways and it's an issue that is affecting users so it's okay with me

adamgonzo commented 1 month ago

Issue persist when you also press enter with blank field

Mandeep56Singh commented 1 month ago

@adamgonzo also happen when clicking cross icon.

Mandeep56Singh commented 1 month ago

@brandonroberts It seems that in handleOnSearch within repositories.tsx, the following code is responsible for the issue:

const handleOnSearch = (search?: string) => {
    if (selectedFilter && !search) {
      return router.push(`${topic}/${toolName}`);
    }
    if (search && /^[a-zA-Z0-9\-\.]+\/[a-zA-Z0-9\-\.]+$/.test(search)) {
      return router.push(`/explore/topic/${topic}/${toolName}/filter/${search}`);
    }
  }; 

The first if condition is causing the problem when the search query is empty, directing the user to a weird page. This could be fixed by updating the route as we did in the second condition. But then when user enter the empty query the page direct to current page and all filter get cleared. My question is when search field is empty why we need to use router , there is no need for first if ?

brandonroberts commented 1 month ago

@Mandeep56Singh yes, the path in the first condition should match. We support that way also so you can clear the search box after filtering for a specific repository

Mandeep56Singh commented 1 month ago

@brandonroberts It is also affecting the clear button. When a user selects a filter and unintentionally inputs the wrong text, clicking the 'clear' button currently clears all fields, including the selected filters. This could lead to a poor user experience, as the user may lose their filters and have to reselect them. It might be better to only clear the text field, preserving the filters.

brandonroberts commented 1 month ago

Maybe. I think we should fix the 404 navigation first, then revisit the UX separately.

adamgonzo commented 1 month ago

@brandonroberts i can fix the error clearing, and the error if user leaves input box blank and presses enter it leaded them to a 404 page

open-sauced[bot] commented 4 weeks ago

:tada: This issue has been resolved in version 2.60.0-beta.3 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket:

open-sauced[bot] commented 4 weeks ago

:tada: This issue has been resolved in version 2.60.0 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: