Closed arnold-yolabs closed 2 years ago
Hi!
I can't think of anything inside mustache.js that sorts that array for you. I put what you shared above into a keep-it-simple-stupid reproduction, and the ordering of items
is kept as is after being rendered:
https://jsbin.com/lixubumica/edit?js,output
If you could make a reproduction for us that does some kind of unexpected sorting, that would be really helpful.
Thank you for helping me narrow down the issue I was experiencing. After a lot of digging and researching, the data sorting issue was occurring in a process hidden to me in the middle of the pipeline, before I was even retrieving the list items for display (even though my data was sorted correctly at the start of the pipeline).
My array looks like this:
And I want to use a mustache template to produce something like this (list items rendered in the order they appear in the array):
However, when I use the following code:
and the following html template:
my final output looks like this, with the array items sorted:
How can I prevent mustache from sorting array values on render?