Fix opencode models dropdown not loading on admin page
The populateOpencodeModelSelect() was called from loadConfigured() which runs in parallel with loadAvailable() in init(). This caused a race condition where the dropdown could be populated before state.available was set. Fixed by moving the populateOpencodeModelSelect() call to after all loaders complete in init(), ensuring state.available is populated first.
This commit is contained in:
@@ -1588,7 +1588,6 @@
|
||||
state.configured = data.models || []; // Legacy support
|
||||
renderOpencodeModels();
|
||||
renderPublicModels();
|
||||
populateOpencodeModelSelect();
|
||||
const selectedAutoModel = state.planSettings && typeof state.planSettings.freePlanModel === 'string'
|
||||
? state.planSettings.freePlanModel
|
||||
: (el.autoModelSelect ? el.autoModelSelect.value : '');
|
||||
@@ -2546,6 +2545,10 @@
|
||||
() => (el.externalTestingConfig ? loadExternalTestingStatus() : null),
|
||||
];
|
||||
await Promise.all(loaders.map((fn) => fn()).filter(Boolean));
|
||||
// Populate opencode model select after loadAvailable() has completed
|
||||
if (el.opencodeModelSelect) {
|
||||
populateOpencodeModelSelect();
|
||||
}
|
||||
// Always try to load provider limits if not already loaded (needed for backup dropdown)
|
||||
if (!state.providerModels || Object.keys(state.providerModels).length === 0) {
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user