Contextual Modal Navigation with useModal or useModalForm
Is there a way to modify the URL when we open a modal, e.g. clicking in an
item
/dashboard
or /items
opens up an item
modal and url changes to /item/:id
, with the background being rendered based on which entry point it came from.
Using react-router v6, I suspect that I may need to add an Outlet
to both Dashboard
and Items
route, then add a nested route in. Though I'm not sure if this will work nicely in Refine. Has anyone attempted this before?4 Replies
Hey @quasar_bear 👋,
Thank you for contacting us! I will try to create an example ⚡️
Which UI framework are you using?
stormy-goldOP•2y ago
react + tailwind, didn't use antd or anything else but i can probably extend from any examples that u come out with 🙏
genetic-orange•2y ago
Hey @quasar_bear, We have prepared an example but you must update your
@pankod/refine-core
dependency to 3.94.0
(https://github.com/refinedev/refine/releases/tag/%40pankod%2Frefine-core%403.94.0). We've added the action
property to useResource
hook and wanted to use it in this example 😅
You can use the npm run refine update
command for update dependency (https://refine.dev/docs/packages/documentation/cli/#update).
Here's the example (made with @pankod/refine-antd
but like you said I don't think there will be any big changes when using headless) https://stackblitz.com/edit/refinedev-refine-byqd2n?file=src/pages/posts/list.tsx
I also added some comments to highlight the necessary changes. If you have any issues while implementing, please reach out 🙏stormy-goldOP•2y ago
really appreciate the help @aliemirs will be diving through it now. ❤️🔥