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.

[StepConnector] Missing index information

See original GitHub issue

Duplicates

  • I have searched the existing issues

Latest version

  • I have tested the latest version

Current behavior 😯

StepConnector component does not return the current index in mui 5 latest version while it does on material ui/core v 4.12.3.

Expected behavior 🤔

It should return the current StepConnector index so as the user to be able to apply custom behaviour on different StepConectors f.i have conditional dashed lines in certain steps instead of continuous line.

Steps to reproduce 🕹

Steps: I am providing two codesandboxes that reproduce the issue. In the first one I have material-ui/core version 4.12.3 installed. I am logging the props inside a custom StepConnector component and it returns the current number of StepConnector along with some additional props (orientation, alternativeLabel, index, active, completed, disabled) while in the other case while having installed mui 5.4.0 it returns an empty Object. How can I access the index props in the second case since it is no longer provided or a substitute solution is not provided either? Also in the migration guide there is no reference regarding this breaking change.

Here are the demos: Mui 4 StepConnector demo Mui 5 StepConnector demo

Your environment 🌎

`npx @mui/envinfo`
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
michaldudakcommented, Feb 11, 2022

Stepper implementation has switched from cloneElement to using context. The correct way to get the information about the index would be to write:

const { index } = React.useContext(StepContext);

This, however, won’t currently work as we don’t export StepContext.

We’ll include StepContext in the module exports to make this possible. As a workaround, for the time being, you can import it directly from “@mui/material/Step/StepContext”

See https://codesandbox.io/s/material-ui-v5-stepconnector-does-not-return-any-index-props-without-passing-it-from-the-instance-forked-bnht2?file=/src/MyStepper.jsx

1reaction
michaldudakcommented, Nov 9, 2022

This was a workaround before the fix was made. You can now import StepContext from the Step module:

import { StepContext } from "@mui/material/Step";
Read more comments on GitHub >

github_iconTop Results From Across the Web

[StepConnector] Missing index information #30900 - GitHub
Current behavior. StepConnector component does not return the current index in mui 5 latest version while it does on material ui/core v 4.12....
Read more >
How to access the index of a MaterialUI StepConnector
I am using a Stepper component, and I would like to style the connectors individually based on their index. The need to be...
Read more >
sys.dm_db_missing_index_details (Transact-SQL) - SQL Server
The sys.dm_db_missing_index_details dynamic management view returns detailed information about missing indexes.
Read more >
StepConnector API - Material UI - MUI
API reference docs for the React StepConnector component. Learn about the props, CSS, and other APIs of this exported module.
Read more >
packages/material-ui/src/StepConnector - GitLab
Download this directory ; StepConnector.d.ts · [core] Ensure component class keys aren't missing (#25754). 1 year ago ; StepConnector.js · [core] Update slot ......
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