Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ra-ui-materialui): Fix <TabbedFormView/> to support string ids with spaces #10324

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

geobde
Copy link

@geobde geobde commented Oct 31, 2024

Bug Fix: TabbedForm Support for IDs with Spaces

Problem:

TabbedForm fails to render tabs when the entity ID contains spaces.
This occurs because TabbedFormView compares the raw location.pathname (which contains
encoded spaces as %20) with tab paths, causing the path matching to fail.

Solution:

Fixed getDecodedPathname utility function that:

  1. Splits the pathname into segments
  2. Decodes URI components to handle %20 and other encoded characters
  3. Removes any remaining spaces
  4. Rejoins the path

This ensures consistent path matching regardless of spaces in entity IDs, allowing
TabbedForm to properly render and navigate between tabs.

Fixes #9545

@geobde geobde changed the title Fix <TabbedFormView/> to support string ids with spaces fix(ra-ui-materialui): Fix <TabbedFormView/> to support string ids with spaces Oct 31, 2024
@djhi
Copy link
Collaborator

djhi commented Nov 5, 2024

Hi and thanks for the PR! Would you mind adding a story and a test? Besides, don't we have the same issue with <TabbedShowLayout>?

@geobde
Copy link
Author

geobde commented Nov 10, 2024

Hello! No, we don't have the same issue with the TabbedShowLayout component because it doesn't use location.pathname to match the tab path.

@geobde
Copy link
Author

geobde commented Nov 10, 2024

@djhi i just added a story & unit test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

String Ids with spaces are not supported by TabbedForm
2 participants