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.

Removing and item for array does not update the list until user scrolls

See original GitHub issue

If I have a list of items:

<virtual-scroll (update)="themeItems = $event" [items]="themes" class="list-group"> <theme-item class="list-group-item" *ngFor="let themeItem of themeItems" [theme]="themeItem" (onDeleteTheme)="deleteTheme( $event, confirmDeleteTheme )"> </theme-item> </virtual-scroll>

onDeleteTheme removes an item for “themes” which is bound to items.

Once removed calling refresh() does not update the list. The item only gets removed once I scroll a little bit. Am I missing something here?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:3
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
rintojcommented, Oct 5, 2017

@blingerson, can you try to make themes an immutable array? ie. when you remove a theme from the array make sure to create a new array:

themes = themes.filter(theme => theme.id !== idOfThemeToBeRemoved)
0reactions
blingersoncommented, Aug 3, 2018

@speige, this did indeed fix my issue. Thank you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

State not updating after removing item from array in PageView
I believe the issue is how the Character object is passed from CharacterListState to CharacterState. It works properly when the user swipes ...
Read more >
Removing Items from an Array in JavaScript - Ultimate Courses
In this article, we'll explore a few different ways to remove an item from an array in JavaScript. I will also show you...
Read more >
Update By Query API | Elasticsearch Guide [8.5] | Elastic
When set to a value less then or equal to scroll_size then a scroll will not be used to retrieve the results for...
Read more >
Docs • Svelte
Complete documentation for Svelte.
Read more >
jQuery API Documentation
If you're updating to a newer version of jQuery, be sure to read the release notes ... Determine whether or not the list...
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