Languages order was changed after updating an document (No longer Master Locale as first index)

Hello,

We're using the same code base for multiple Prismic repos and after making an update in one of our repos (Settings - Global Config), the languages array changed order when getting the information for this repo causing the default language to be english instead of swedish for this site.
Whereas another repo that is set up the same, gets swedish, but we haven't updated any documents in this one.

What determines the order of the languages array?

Should the master locale be first always or is that a wrong assumption by us and we need to change our code on how to handle this?

Hey @skeleton-support,

Based on my understanding, if you query /api/v2, then languages[0] should be your master locale. Is it possible that someone on your team submitted a request to change the master locale?

Could you send me a list of your repositories and the language that should be the master for each one? (You can send it in a DM if you like.)

Sam

@samlittlefair
Something is broken. Language[0] is not my real master locale anymore.
We have Spanish as the master locale but today our website was in English...

I have updated my code with this to fix it.

It could be cool to have something like isMaster instead of relying on the first position of an array.
id: string
name: string
isMaster: boolean

Hey @ivacormor,

Yes, you're right, this is a bug. The team is working on it, and I'll post an update when we have a fix.

Sam

Hi @ivacormor,

This should now be fixed. Let me know if you're still having issues.

Sam

Also, in line with your suggestion the team have added an is_master property to languages[0] as a redundancy.

Sam