nestjsx-crud

my request like this
const { tableProps, searchFormProps } = useTable({
syncWithLocation: true,
onSearch: (values) => {
setSearchFormValues(values as Record<string, any>);
return generateFilters(values as Record<string, any>);
},
meta: {
join: [
{
field: "app",
},
],
},
});
const { tableProps, searchFormProps } = useTable({
syncWithLocation: true,
onSearch: (values) => {
setSearchFormValues(values as Record<string, any>);
return generateFilters(values as Record<string, any>);
},
meta: {
join: [
{
field: "app",
},
],
},
});
parsed url = ?join%5B0%5D=app&limit=10&page=1&offset=0 It doesn't work, but if I change to join=app it works
5 Replies
kapa.ai
kapa.ai2w ago
Hi @tingadev. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- I understand you're having an issue with the join parameter in your request when using useTable with syncWithLocation: true. The problem appears to be related to how the URL parameters are being encoded. Based on the knowledge sources, this seems to be related to how syncWithLocation works with URL parameters. When syncWithLocation is enabled, the table's state (filters, pagination, sorting) is encoded in the URL parameters, but there might be an issue with how complex parameters like arrays are handled. The issue you're experiencing is that when your meta includes a join array, it's being encoded in the URL as join[0]=app, but your API might be expecting it in the format join=app. Unfortunately, the knowledge sources don't provide specific information about handling join parameters with the nestjsx-crud adapter. There is a related issue mentioned about join/populate support for getOne operations in the nestjsx-crud adapter here, but it doesn't directly address your URL parameter formatting issue. As a workaround, you might want to try: 1. Modifying your meta to use a string instead of an array if your API expects it that way:
meta: {
join: "app"
}
meta: {
join: "app"
}
2. If you need to maintain the array structure in your code but need a different URL format, you might need to implement a custom solution to transform the parameters before they're sent to the API. If this issue persists, you might want to report it as a bug to the refine team, as it could be related to how the nestjsx-crud adapter handles URL parameter encoding when syncWithLocation is enabled. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@761921731505946634> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
absent-sapphire
absent-sapphireOP2w ago
I mean from the past, I already use like
meta: {
join: "app"
}
meta: {
join: "app"
}
and url like: join[0]=app but now its not work anymore, then I try to change to join=app it work. So weird, Does refinedev/nestjsx-crud upgrade? I mean from the past, I already use like meta: { join: "app" } and url like: join[0]=app but now its not work anymore, then I try to change to join=app it work. So weird, Does refinedev/nestjsx-crud upgrade? @kapa.ai
kapa.ai
kapa.ai2w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I understand your confusion. It seems there might have been a change in how the join parameter is handled in the nestjsx-crud adapter. Looking at the knowledge sources, there was indeed an issue related to join/populate functionality in the nestjsx-crud adapter that was addressed, as mentioned in this GitHub issue. However, the specific details about the URL parameter format change aren't explicitly documented in the provided sources. The behavior change you're experiencing (from join[0]=app to join=app) could be related to an update in the nestjsx-crud adapter. Refine does release updates regularly, as evidenced by their CLI update command mentioned in the CLI documentation. If you've recently updated your refine packages, this could explain the change in behavior. You can check your current version and update history using:
npm run refine update
npm run refine update
This will show you which packages have been updated and to what versions. For now, since join=app is working for you, I'd recommend sticking with that format. If you need more detailed information about this specific change, you might want to: 1. Check the changelog or release notes for the nestjsx-crud adapter 2. Open an issue on the refine GitHub repository to get clarification from the maintainers Would you like me to provide more information about how to properly configure the join parameters with the current version of the nestjsx-crud adapter? ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2w ago
<@761921731505946634> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?