Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Search route isn't working properly #92

Open
Raaaaaaamim opened this issue Jan 6, 2025 · 3 comments
Open

Search route isn't working properly #92

Raaaaaaamim opened this issue Jan 6, 2025 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@Raaaaaaamim
Copy link

Raaaaaaamim commented Jan 6, 2025

Describe the bug

The End date feature in the Search route isn't working, I have tried many times with many start and end dates but Its not working, It's giving me the same result for every single end date.

Expected behavior

Screenshot 2025-01-06 232212
Screenshot 2025-01-06 232243
I thought it's happening because of my fromatDate() func, but there are no issues

Actual behavior

Screenshot 2025-01-06 232635
Screenshot 2025-01-06 233931
Screenshot 2025-01-06 233900
I have tried with 2 different end dates here and its giving me the same result, it happens with every single end date

Additional context

const {
data: searchResults,
isLoading,
fetchNextPage,
hasNextPage,
isFetchingNextPage,
} = useInfiniteQuery({
queryKey: [
"search",
debouncedSearchQuery,
type,
status,
season,
sort,
genres,
startDate,
endDate,
rated,
score,
language,
],
queryFn: async ({ pageParam = 1 }) => {
const formatDate = (date) => {
if (!date) return "";
const [year, month, day] = date.split("-").map((part) => part || "0");
return ${year}-${month}-${day};
};
const response = await axios.get(
${api}/hianime/search?q=${encodeURIComponent( debouncedSearchQuery )}&type=${type}&status=${status}&season=${season}&sort=${sort}&genres=${genres}&page=${pageParam}&start_date=${formatDate( startDate )}&end_date=${formatDate( endDate )}&rated=${rated}&score=${score}&language=${language}
);
return response.data;
},
initialPageParam: 1,
getNextPageParam: (lastPage) =>
lastPage?.data?.hasNextPage ? lastPage?.data?.currentPage + 1 : undefined,
enabled: debouncedSearchQuery.length > 0,
});

const debouncedSetSearchQuery = useCallback(
debounce((value) => {
setSearchQuery(value);
}, 500),
[setSearchQuery]
);

const handleSearchInput = (e) => {
const value = e.target.value;
debouncedSetSearchQuery(value);
};
No response

@Raaaaaaamim Raaaaaaamim added the bug Something isn't working label Jan 6, 2025
@ghoshRitesh12
Copy link
Owner

@Raaaaaaamim, have you checked if hianime also has the same issue or not?

@Raaaaaaamim
Copy link
Author

@Raaaaaaamim, have you checked if hianime also has the same issue or not?

Yes!! And in hianime it works just fine

@ghoshRitesh12
Copy link
Owner

@Raaaaaaamim, have you checked if hianime also has the same issue or not?

Yes!! And in hianime it works just fine

I'll look into it and push a fix soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants