params-override
hi. when providing params to a route using react router v6 those get always overridden by the ones provided by refine like
pageSize
and current
. how do i pass the params correctly so they are there additionally to the ones used by refine?37 Replies
Hey @hannesnussmueller 👋 ,
How do you pass parameters? Can you share your sample code? 👊
deep-jade•3y ago
@Omer i tried lots of things already, especially like this:
have also tried to use showUrl instead of push, or use push like this:
push("productsearch/purchase")
to test and see if i can access the query parameters then on the purchase page with useParams()
since pageSize
and current
should be at least present since they are in the url but the response was an empty objectI got it ⚡️Can you create a GitHub issue for this? We can fix it today 🎉
deep-jade•3y ago
i don't have gh any longer sounds like i need to reestablish it
firm-tan•3y ago
@hannesnussmueller seems you only need access to your specific param, or? How does your special route path in
App.tsx
look like?deep-jade•3y ago
path: "/productsearch/purchase",
firm-tan•3y ago
You should distinguish between
route params => :id
and query params => ?id=
. Seems like a route param is completely fine in your use case and you don't need a query param. Try it like this:
path: "productsearch/purchase/:id",
and change to deep-jade•3y ago
👍 sneaky joe. this works thanks
haha cool @cyborg31
but we'll still fix the query parameters 🤓
firm-tan•3y ago
I hope so ^^
I created a PR but I think we can handle it better 💯
https://github.com/pankod/refine/pull/2298/files
Hey @hannesnussmueller 👋 ,
We've fixed this issue with
@pankod/refine-core@3.56.11
⚡continuing-cyan•3y ago
Hey guys! I´m kind of confused. I was trying to pass state through useNavigation -> push and UseLocation() -> state. At first I couldn´t do it. I was trying this way:
import { useNavigation } from "@pankod/refine-core";
const { push } = useNavigation();
const handleOk = () => {
close();
push("create", { resourceIds: [1,2,3]} );
};
Hey @albcunha 👋,
We probably don't keep state. Can you create an issue? https://github.com/pankod/refine/blob/next/packages/core/src/hooks/useTable/index.ts#L225
GitHub
refine/index.ts at next · pankod/refine
A React-based framework for building internal tools, rapidly. - refine/index.ts at next · pankod/refine
continuing-cyan•3y ago
Then it worked this way:
or you can use query parameter instead of state