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.

Progress indicator: Steps are undefined

See original GitHub issue

Title

When using the progress indicator component, there is a chance that you will get a this.steps is undefined exception.

Detailed description

Problem

When using the progress indicator in the following way:

<ibm-progress-indicator 
                        [current]="current"
                        [steps]="steps"
>
</ibm-progress-indicator>

The progress indicator throws an exception saying this.steps is undefined.

But when you order the inputs like this:

<ibm-progress-indicator 
                        [steps]="steps"
                        [current]="current"
>
</ibm-progress-indicator>

The exception isn’t thrown.

Reason

I believe the reason for this is that the input current has a setter that references the steps variable. If the inputs are not ordered correctly an exception is thrown.

Solution

I believe a good solution would be to move the setter code to the ngOnChanges lifecycle hook and check there if all the inputs are available before running the code.

What version of the Carbon Design System are you using?

carbon-components: “10.21.0”, carbon-components-angular: “4.19.1”,

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
cal-smithcommented, Nov 27, 2020

It only occurs with these Angular versions in the project that I have been working on.

Ah, yeah we’re keeping the project on Angular 7 for now, so it’s totally possible this is a version specific issue. Still worth fixing of course.

Even though the issue does not occur right now I still propose to move the code being executed in the setter to the ngOnInit, where we are sure that all inputs are available, and handle subsequent updates of current in the ngOnChanges.

Seems like a reasonable change to me! We’ve been using the getter/setter pattern with reasonable success, but it’s definitely caused a few headaches as well. I think in this case it might be a bit more future proof if we go with the traditional ngOnInit + ngOnChanges combo.

1reaction
Rogier-blipcommented, Nov 2, 2020

I could make a PR for this. Just let me know if this is something you want to fix 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Progress indicator: Steps are undefined · Issue #1576 - GitHub
When using the progress indicator component, there is a chance that you will get a this.steps is undefined exception.
Read more >
Can't add lightning:progressStep in lightning ...
I've been playing around and it seems that its a bit buggy. From my point of view, it doesn't like to get the...
Read more >
Waterfall progress indicator - SKY UX Documentation
Use waterfall progress indicators for long or complex setup processes with at least three steps that users typically complete only once.
Read more >
Displaying Progress indicator based on the inputs called total ...
I am trying to display the progress indicator dynamically based on the inputs provided(which are totalSteps which are 5 in this case, ...
Read more >
The Progress Indicator element - HTML - MDN Web Docs
It must be a valid floating point number between 0 and max , or between 0 and 1 if max is omitted. If...
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