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.

mz-collapsible-item bug

See original GitHub issue

When looping through an array then modifying the array, doesn’t update the collection items.

Html:

<mz-card>
  <mz-card-content>
    <button mz-button (click)="changeValues();">Click me</button>
    <button mz-button (click)="changeValues2();">Click me</button>
    <button mz-button (click)="changeValues3();">Click me</button>
    <button mz-button (click)="changeValues4();">Click me</button>
    <mz-collapsible class="col s12" *ngIf="list.length > 0">
      <mz-collapsible-item *ngFor="let item of list">
        <mz-collapsible-item-header>
          {{item}}
        </mz-collapsible-item-header>

        <mz-collapsible-item-body>
          {{item}} body
        </mz-collapsible-item-body>
      </mz-collapsible-item>
    </mz-collapsible>
  </mz-card-content>
</mz-card>

TS:

list = ['Item1', 'Item2', 'Item3'];

constructor() {}

changeValues() {
  this.list = ['Item5', 'Item6']; // Just adds the values to the collapsible doesn't set it.
}

changeValues2() {
  this.list = ['Item7', 'Item8']; // Same as in changeValues()
}

changeValues3() {
  this.list = []; // Removes everything from the collapsible
}

changeValues4() {
  this.list = []; // Doesn't resets the collapsible items like in changeValues3()
  this.list = ['New item', 'New item2']; // Just adds these two to the collapsible
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
scotecommented, Aug 14, 2017

Thanks you for reporting this bug. We will look to fix it in upcoming release.

0reactions
renatop7commented, Feb 20, 2018

@caom92 this is a nice workaround actually. I ended up ditching using this collapsible, I was having a big impact in the perfomance to render them over and over again, so I created my own and was incredible easy tbh.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Collapsible sections: Linking to auto-expand a section and ...
As already discussed in some previous threads collapsible sections have a lowered functionality when being linked to; even though Section headers have.
Read more >
collapsible fieldset not working [#2339867] | Drupal.org
Here is the bug: If I create collapsible fieldset using field_group, they will not work under a bootstrap theme.
Read more >
Collapsible Sections on SharePoint Modern pages
1. Go to the site collection page where you want to create collapsible section. 2. Click on the edit option from the command...
Read more >
Manual talk:Collapsible elements - MediaWiki
Click on a TOC item which lies within a currently hidden area, nothing will happenEdit. If a person clicks on a TOC item...
Read more >
Bootstrap Collapse Is Not Animated The First Time And Has a ...
... however when the collapsible element is getting hidden there is no ... any links concerning bootstrap collapse bugs caused by heights.
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