Skip to content

TabbedForm w/ syncWithLocation shows nothing if resource id contains URL-encoded chars #8380

@stesie

Description

@stesie

What you were expecting:

TabbedForm renders one visible tab.

What happened instead:

No tab is visible.

Steps to reproduce:

Use TabbedForm on a resource with string-type ids + have an id that contains a URL-encoded char, e.g. "space" which is encoded as "%20"

Related code:

https://github.com/marmelab/react-admin/blob/master/packages/ra-ui-materialui/src/form/TabbedFormView.tsx#L85

  • resolvedPath.pathname is like /posts/better no spaces here
  • location.pathname is like /posts/better%20no%20spaces%20here

... hence no match. For no route. And therefore all tabs hidden.

StackBlitz

https://stackblitz.com/edit/github-c52e17

click the (first) Post named "Post to break stuff"

Other information:

Environment

  • React-admin version: 4.5.1
  • Last version that did not exhibit the issue (if applicable):
  • React version: 17
  • Browser:
  • Stack trace (in case of a JS error):

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions