# Problem repeating item in list viewer

**URL:** https://community.thunkable.com/t/problem-repeating-item-in-list-viewer/48999
**Category:** Questions about Thunkable X
**Created:** [September 26, 2018, 10:02pm UTC](https://community.thunkable.com/t/problem-repeating-item-in-list-viewer/48999 "2018-09-26T22:02:12Z")
**Posts on this page:** 1
**Showing post:** 14

<div class="post-metadata">

### Author: ![Mark](https://sea1.discourse-cdn.com/flex015/user_avatar/community.thunkable.com/mark/32/18133_2.png) [@Mark](https://community.thunkable.com/u/Mark)
#### Post date: [September 27, 2018, 9:54pm UTC](https://community.thunkable.com/t/problem-repeating-item-in-list-viewer/48999/14 "2018-09-27T21:54:11Z")

</div>

> [@AcrobatEpee](#):
>
> @Mark Is it really impossible to use localstorage in loops ?

It’s not impossible, but it can lead to unexpected results in certain circumstances. The basic issue is that `'LocalStorage.Get'` (and Set) is currently an asynchronous operation, meaning that it is executed more-or-less at the same time as the blocks that come after it - _including blocks that come after it in a loop_. That’s we we have the `'then do'` slots, which tell the `'LocalStorage.Get'` what to do once it gets a result.

This affects your loop in that all the `'Users.Get'` blocks will execute at more or less the same time. Moreover, they will all happen at more or less the same time as your loop is incrementing the `'Friends'` variable! So the value of `'Friends'` with the `'Users.Get'` blocks could be just about any value between 1-25 in any of the `'Users.Get'` blocks.

I wrote a little more about this sort of problem in [Asynchronous Blocks within Loops](http://community.thunkable.com/t/asynchronous-blocks-within-loops/33524). It also contains a workaround for how to deal with such issues.

Also note that we are thinking about possible solutions to this issue, but have no timetable yet.

I’ll also just note that @User81 is correct that you need test for the string “null” rather than the using the green null-block. I know it’s confusing ;-( . He’s also right that it would be easier if you could just save and get the entire list at once. Then you can loop over the list and have fewer problems.

-Mark

---

_[View the full topic](https://community.thunkable.com/t/problem-repeating-item-in-list-viewer/48999)._
