open-sauced / app

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

Bug: Search fields redirects to 404 error page #3949

Closed Mandeep56Singh closed 2 months ago

Mandeep56Singh commented 3 months 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 3 months 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 3 months ago

.take

github-actions[bot] commented 3 months 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 3 months ago

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

adamgonzo commented 3 months ago

@Mandeep56Singh yes i get the same issue

Mandeep56Singh commented 3 months 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 3 months 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 3 months 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 2 months ago

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

adamgonzo commented 2 months ago

.take

Mandeep56Singh commented 2 months ago

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

Mandeep56Singh commented 2 months 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 2 months ago

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

adamgonzo commented 2 months 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 2 months ago

Issue persist when you also press enter with blank field

Mandeep56Singh commented 2 months ago

@adamgonzo also happen when clicking cross icon.

Mandeep56Singh commented 2 months 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 2 months 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 2 months 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 2 months ago

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

adamgonzo commented 2 months 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 2 months 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 2 months 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: