Is the order of items in a list reliable?

If I add an item to a list, will it always be the last item in the list?

Will the order always be maintained (assuming I don’t do anything else to it)? E.g. the first item added will be the first item, the 5th will always be the 5th, etc.

I know lots of y’all think “yeah probably that’s right” but … would you do this for something system critical or something involving money?

In my experience it’ll always remain the same.

Something involving money tends to need more details though so you may want to have it search rather than store in data lists.

Also in the scenario you need to rearrange that list there’s not a pretty way to do it without 3rd party plugins.

Also for whatever reason if you may want to :filter or :sort that list it will kill performance since it’ll pull the initial data then filter/sort will have to re run the data.

There are very few scenarios I personally like to save lists like that on the data type over making it a data type itself and/or using do search for.

Those lists don’t lazy load either so if you load it and there’s 1000 things it will pull the full list.

Additionally it complicates future product development if you ever want to simply add a field to that data.

Here’s a real scenario to look at: “list of images” on a post for a classifieds marketplace. The photos are uploaded but now you want to edit the post and change the image order. The only way to do this is using a 3rd party plugin like list shifter or drag-it. Not clean.

Where as if those images were their own data type you could just simply manipulate the “order” field and sort by it.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.