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

Clone functionality is broken on create page with TabbedForm #4066

Closed
akshah123 opened this issue Nov 27, 2019 · 4 comments · Fixed by #4422
Closed

Clone functionality is broken on create page with TabbedForm #4066

akshah123 opened this issue Nov 27, 2019 · 4 comments · Fixed by #4422
Assignees
Labels

Comments

@akshah123
Copy link
Contributor

akshah123 commented Nov 27, 2019

What you were expecting:
When using <CloneButton>, I expected my tabbed form to have clones values across all tabs with 3.0 upgrade.

What happened instead:
When I click on clone button, I do see cloned values on the first tab of create form. However, when I click on another tab it is empty. If I go back to orginal tab, it also has lost all pre-filled values.

Steps to reproduce:
Setup a resource with create page. Have create page use tabbed form with fields split between two tabs.
Have a list page with CloneButton.
On list page, click on clone button for 1 row.
React-admin will take you to create page with values in the URL query string.
See that on 1st tab values are pre-filled.
Click on second tab. Notice that URL no longer shows query string.
2nd tab will show blank fields.
Click on 1st tab. See that pre-filled values are now replaced with blank fields.

Other information:
I think this issue is related to 3.x change where CloneButton is using search instead of state. With tabbed form, clicking on a tab results in URL changing and losing search values which seems to cause this problem.

Environment

  • React-admin version: 3.0.1
  • Last version that did not exhibit the issue (if applicable): 2.9.x
  • React version: N/A
  • Browser: Chrome
  • Stack trace (in case of a JS error):N/A

Code Sandbox
https://codesandbox.io/s/simple-po3c1

  • Go to "Posts".
  • Click on clone button on a given row
  • On create page notice that "Summary" Tab has values pre-filled but "Body" Tab is empty.
  • Click back on "Summary" tab and notice that all pre-filled values are now lost.
@djhi
Copy link
Collaborator

djhi commented Nov 28, 2019

Thanks for reporting this. If you are able to illustrate the bug or feature request with an example, please provide a sample application via one of the following means:

@akshah123
Copy link
Contributor Author

@djhi https://codesandbox.io/s/simple-po3c1

Take a look at Posts clone functionality.

@fzaninotto
Copy link
Member

Thanks, indeed there is a bug.

@akshah123 akshah123 changed the title Clone functionality is broken on create page with TabbedFrom Clone functionality is broken on create page with TabbedForm Jan 13, 2020
@akshah123
Copy link
Contributor Author

Updated the sandbox to show bug is still there with version 3.1.3.

@fzaninotto Looks like this issue may be a by product of this issue you created: supasate/connected-react-router#302

Is there anyway to fix this while that other PR is still open?

Unfortunately, this bug is blocking us from upgrading to 3.x.

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

Successfully merging a pull request may close this issue.

3 participants