Redirect: Adding page table filtering [MAPS-236]#10659
Open
Franco Banfi (FBanfi) wants to merge 10 commits intoredirect-maps-209from
Open
Redirect: Adding page table filtering [MAPS-236]#10659Franco Banfi (FBanfi) wants to merge 10 commits intoredirect-maps-209from
Franco Banfi (FBanfi) wants to merge 10 commits intoredirect-maps-209from
Conversation
c2a0138 to
300324e
Compare
# Conflicts: # apps/redirect/src/components/RedirectsTable.tsx # apps/redirect/test/components/RedirectsTable.spec.tsx # apps/redirect/test/utils/testUtils.ts
Comment on lines
+28
to
+40
| const load = useCallback(async () => { | ||
| setIsFetching(true); | ||
| setError(null); | ||
| try { | ||
| const result = await fetchRedirects(sdk); | ||
| setAllData(result); | ||
| } catch (err) { | ||
| setError(err instanceof Error ? err : new Error(String(err))); | ||
| } finally { | ||
| setIsFetching(false); | ||
| } | ||
| }, [sdk]); | ||
|
|
Collaborator
There was a problem hiding this comment.
I think there's no need for useCallback here, we could define the function inside the useEffect directly
Comment on lines
12
to
13
| "@tanstack/react-query": "^5.90.21", | ||
| "@tanstack/react-query-devtools": "^5.91.3", |
Collaborator
There was a problem hiding this comment.
We can remove tanstack from here as well
Comment on lines
+24
to
+30
| const getSearchableFields = (redirect: RedirectEntry, locale: string): (string | undefined)[] => [ | ||
| redirect.fields.redirectFromContentTypes?.title, | ||
| redirect.fields.redirectToContentTypes?.title, | ||
| redirect.fields.reason[locale], | ||
| redirect.fields.redirectFromContentTypes?.slug, | ||
| redirect.fields.redirectToContentTypes?.slug, | ||
| ]; |
Collaborator
There was a problem hiding this comment.
Would it make sense to remove the undefined values and always return a string[]?
| return { | ||
| redirects: data?.redirects || [], | ||
| total: data?.total || 0, | ||
| redirects: paginatedRedirects, |
Collaborator
There was a problem hiding this comment.
This is returning just one page of results, right?
I think we want all results with no pagination here. Since we'll be filtering these results, there may be some results that we want to get that would be left out if we keep the pagination. Then we can paginate after the filtering
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
This update includes the filtering for the page table.
Disclaimer: The query filtering of the
redirectFromandredirectToreferences titles could not be done due to some api limitations. So we may need client filtering there, we are still looking for other options. This will be followed in another PR.Approach
Added the different components to handle the table filtering.
Testing steps
Automated tests added.
Grabacion.de.pantalla.2026-03-04.a.la.s.4.08.51.p.m.mov
Breaking Changes
N/A
Dependencies and/or References
Link to maps-236
Deployment
N/A