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.

Stepper - does not render correctly with JSS in production with SSR

See original GitHub issue

The Stepper component appears to cause JSS to miscount class names in production, causing the UI to break.

  • [x ] This is a v1.x issue.
  • [x ] I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

Stepper renders properly when environment is set to ‘development’.

image

Current Behavior

Stepper renders improperly when environment is set to ‘production’. It renders a giant black svg circle with the stepper text below (which is now unformatted)

image

Steps to Reproduce

  1. Clone the ssr example from this repository.
  2. Create a Stepper component and import into App component (and removed other components).
  3. Changed the webpack.config.js mode from mode: process.env.NODE_ENV || 'development', to mode: process.env.NODE_ENV || 'production', and ran it.

Component.js

/*
 * Copyright (c) 2018, Critical Labs LLC
 ******************************************************************************/
import React from 'react';
import PropTypes from 'prop-types';

import Stepper from '@material-ui/core/Stepper';
import Step from '@material-ui/core/Step';
import StepLabel from '@material-ui/core/StepLabel';
import StepContent from '@material-ui/core/StepContent';

class Component extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      activeStep: 0,
    };
  }

  render() {
    return (
      <div>
        <Stepper orientation="vertical" activeStep={this.state.activeStep}>
          <Step>
            <StepLabel>Test</StepLabel>
            <StepContent>Hello World</StepContent>
          </Step>
        </Stepper>
      </div>
    );
  }
}

export default Component;

App.js

import React from 'react';
import PropTypes from 'prop-types';
import { withStyles } from '@material-ui/core/styles';
import Component from './Component.js';

const styles = theme => ({
  root: {
    backgroundColor: '#f00',
  },
});

class App extends React.Component {
  render() {
    const { classes } = this.props;

    return (
      <div className={classes.root}>
        <Component/>
      </div>
    );
  }
}

App.propTypes = {
  classes: PropTypes.object.isRequired,
};

export default withStyles(styles)(App);

Context

This doesn’t allow me to use the Stepper component in production. I may try to fallback to the v0 Stepper, as it works fine and I’m running both versions in parallel currently.

Your Environment

Tech Version
Material-UI 1.4.2
React version 16.4.1
Chrome version (build) 67.0.3396.87

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
oliviertassinaricommented, Aug 7, 2018

@hluedeke You need to make sure you use the production mode on the server and on the client when doing server-side rendering.

0reactions
oliviertassinaricommented, Aug 17, 2018

@hluedeke I would love to see that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Stepper - does not render correctly with JSS in production with ...
The Stepper component appears to cause JSS to miscount class names in production, causing the UI to break. [x ] This is a...
Read more >
leaflet map doesn't render properly in stepper from mdb
The stepper is a component of mdb and I need to render the leaflet map ... But the stepper doesn't load properly in...
Read more >
material-ui/core/CHANGELOG.md - UNPKG
The Tabs `fullWidth` and `scrollable` properties can't be used at the same time. The API change prevents any awkward usage. 22.
Read more >
React Stepper component - Material UI - MUI
Steppers convey progress through numbered steps. It provides a wizard-like workflow. Steppers display progress through a sequence of logical and numbered steps.
Read more >
@mui/styles | Yarn - Package Manager
The withStyles JSS utility is no longer exported from @material-ui/core . You can use @material-ui/styles instead. Make sure to add a ThemeProvider at...
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