question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TabbedForm validation differences between development and production build

See original GitHub issue

What you were expecting: I was expecting the FormTab instances in a TabbedForm to turn red in case any of the child inputs are invalid. This is working as expected during development. The className “RaTabbedForm-errorTabButton-41” is being added to the FormTab.

Opening the page containing the ‘Create’ and ‘TabbedForm’ component shows all tabs as invalid even before pressing the save button.

What happened instead: After running yarn build and deploying this production build the tabs are not being marked as invalid. The inspector is showing a className “jss40”, but this class can’t be found in the generated sources.

The tabs are not turning red on validation errors.

Other information: Dev environment (yarn start) ReactAdminDev

Prod environment (yarn build) ReactAdminProd

Environment

  • React-admin version: 3.9.4
  • Last version that did not exhibit the issue (if applicable):
  • React version: 16.14.0
  • Browser: Google Chrome 86.0.4240.80
  • Stack trace (in case of a JS error):

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
donovantccommented, Feb 9, 2021

I’ve been struggling with this issue for a while now, so I decided to create a very basic setup using create-react-app and add react-admin as mentioned in the react-admin tutorial.

I added a create component which has 2 tabs, and set all fields to required. In development, if you start entering a field, but leave it empty and switch to the next tab, you already see the previous tab with red text.

image

However in the production build, this doesn’t happen. The text remains its original colour.

Here is the codesandbox with this basic setup. Here you will see the correct behaviour in the development build.

I have also deployed this code directly from the codesandbox via Netlify: https://csb-m5c9z.netlify.app/#/users/create. Here you will see the incorrect behaviour in the production build.

Looking at the css in the production build, you can see that the color from react-admin styles jss91 is overwritten by the MuiTab-TextColorInherit class.

image

Looking at how they are included in the final build, the MuiTab styles are loaded after the RaTabbedForm styles, meaning they will get preference.

image

So I think this may be related to how the CSS is imported or loaded.

@fzaninotto @djhi unless I am doing something wrong, I believe that this is still an issue.

2reactions
fzaninottocommented, Mar 3, 2021

Should be fixed by #5984

Read more comments on GitHub >

github_iconTop Results From Across the Web

Difference between production and development build in ...
The production build runs uglify and builds your source files into one or multiple minimized files. It also extracts CSS and images and...
Read more >
Validation on tabbed form - Yii Framework Forum
I have a model with many fields,and I have used CJuiTabs for displaying the form in 4 different tabs. The submit button is...
Read more >
TabbedForm - React-admin - Marmelab
<TabbedForm> is often used as child of <Create> or <Edit> . ... React-admin highlights the tabs containing validation errors to help users locate...
Read more >
Creating tabbed form with ConfiForms and Refined UI toolkit ...
This tutorial demonstrates how you can setup a form in dialog mode with Refined Toolkit app. We will setup a form with just...
Read more >
TabbedForm Control - Telerik UI for WinForms Components
Each of the tabs is associated with a separate container holding the actual tab content thus creating a separate view. Title Bar Settings....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found