[object Object] Error appearing in admin dropdown selectors

AI-generated summary

A user reports an issue in the admin interface where dropdown selectors display “[object Object]” as an option, which appears to be a bug introduced in the latest version jord8on. Other users confirm the problem, and j.jaffeux identifies the root cause: site settings called “enums” are arrays of objects without proper key information. After some consideration, j.jaffeux reverts the previous fix and implements a new solution with tests, which they believe resolves the issue j.jaffeux.

I just added another support issue which may be related to what I’m illustrating in this video:

For some reason when I click on the drop-down menus, in several fields of the admin interface, I’m greeted with this “[object Object]” option, which appears to be an error.

Here’s a little screencast to show what I’m experiencing…

I have the problem, I think it’s introduced in the latest version.

I believe @j.jaffeux is on it?

Yes.

I see exactly what’s going on. I have to think about it though. It’s very unexpected to me and I don’t have a straightforward fix.

Basically we have site settings we call “enums” which are not flat arrays but array of objects, however enum site setting doesn’t give info about the key used in the object.

problem with this is tests-passed pointing to this version. I prefer a reverse. Otherwise whoever upgrade to this latest version will have a problem.

This was tricky. I reverted the previous fix, and created this new fix with tests:

https://github.com/discourse/discourse/commit/74f2d480186b6cd87a6032ccfadc5721a76eb4b3

I think this should solve all issues related to enums.