Sending meta with routes in show button

I want to have two buttons in my list view that are both show buttons but use the meta parameter to add additional state information. Doesn’t seem to work. Am I approaching this right? Basically on the show page I should be about to show different content based on this state variable. Ideally it shouldn’t show in the url route.
3 Replies
kapa.ai
kapa.ai4mo ago
Hi @Matt. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Yes, you are approaching it correctly. The meta prop in the ShowButton component is used to pass additional parameters to the show method of useNavigation. By default, existing parameters in the route are used by the show method. You can pass additional parameters or override the existing ones using the meta prop. Here is an example of how you can use the meta prop:
const MyComponent = () => {
return <ShowButton meta={{ authorId: "10" }} />;
};
const MyComponent = () => {
return <ShowButton meta={{ authorId: "10" }} />;
};
In this example, the meta prop is used to pass an additional authorId parameter to the show method. If the show action route is defined by the pattern: /posts/:authorId/show/:id, this authorId will be used in the route. However, please note that the meta prop will not prevent the parameter from appearing in the URL route. The parameters passed through the meta prop will be included in the URL route. For more information, you can refer to the documentation here (https://refine.dev/docs/ui-integrations/ant-design/components/buttons/show-button#meta). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai4mo ago
<@480113761881948183> kapa.ai is still learning and improving, please let us know how it did by reacting below
foreign-sapphire
foreign-sapphire4mo ago
This hasn't worked for me.