Skip to content

Redirect: Adding page table filtering [MAPS-236]#10659

Open
Franco Banfi (FBanfi) wants to merge 10 commits intoredirect-maps-209from
redirect-maps-236
Open

Redirect: Adding page table filtering [MAPS-236]#10659
Franco Banfi (FBanfi) wants to merge 10 commits intoredirect-maps-209from
redirect-maps-236

Conversation

@FBanfi
Copy link
Copy Markdown
Collaborator

@FBanfi Franco Banfi (FBanfi) commented Mar 3, 2026

Purpose

This update includes the filtering for the page table.

Disclaimer: The query filtering of the redirectFrom and redirectTo references 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

@FBanfi Franco Banfi (FBanfi) requested a review from a team as a code owner March 3, 2026 15:45
# 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]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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",
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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,
];
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to remove the undefined values and always return a string[]?

return {
redirects: data?.redirects || [],
total: data?.total || 0,
redirects: paginatedRedirects,
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants