You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We would like to route based on a unique slug using react router and the refine resource definitions rather than the ids to have more readable URLs. When we try and use a resource path such as show: "/publishers/show/:handle" it doesn't substitute the handle field but rather puts :handle directly in the URL.
Do Refine resources only accept the :id path param?
KGMaxey
changed the title
[BUG] Resource routes using path param other than id
[BUG] Resource routes using path param other than id not being substituted in URL
Aug 16, 2024
Found it. It looks like this is because ShowButton actually functions under the assumption that you're using the id param and only substitutes that. Quick fix for anyone interested would be to swizzle out that component or just use the onClick param, that seems to override the behavior. So something like:
<ShowButton
hideText
size="small"
onClick={() => go({ to: `show/${record.handle}` })}
/>
Describe the bug
We would like to route based on a unique slug using react router and the refine resource definitions rather than the ids to have more readable URLs. When we try and use a resource path such as
show: "/publishers/show/:handle"
it doesn't substitute the handle field but rather puts:handle
directly in the URL.Do Refine resources only accept the
:id
path param?Example App.tsx after bootstrap
Example pages/publishers/list.tsx
Example pages/publishers/show.tsx
Steps To Reproduce
publisher
table with columns:id
,publisher_name
,handle
into supabasepublisher_name: "Test Publisher"
andhandle: "test-publisher"
Test Publisher
in table and click the view icon:handle
Expected behavior
Refine correctly substitutes the
:handle
param with thehandle
field from the entity in the URL.Packages
Additional Context
No response
The text was updated successfully, but these errors were encountered: