fix: re-fetch instrument data after login for new machines
Auth success handler now eagerly loads instrumentSelectorData via listPlugins + getSoundfontCatalog. The mount-time useEffect runs before auth token is set, so it silently fails on new machines.
This commit is contained in:
@@ -7593,6 +7593,22 @@ const App = () => {
|
||||
window.__soundfontCatalog = cat;
|
||||
}).catch(() => {});
|
||||
} catch (e) { }
|
||||
// Re-fetch instrument data after auth (useEffect on mount runs before token is set)
|
||||
try {
|
||||
window.SonicAPI.listPlugins().then(async data => {
|
||||
try {
|
||||
const catResp = await window.SonicAPI.getSoundfontCatalog?.() ?? await fetch('/api/v1/plugins/soundfonts/catalog').then(r => r.json());
|
||||
const catalog = catResp.full_catalog || {};
|
||||
data.soundfonts = (data.soundfonts || []).map(sf => {
|
||||
const sfId = sf.id.replace('sf_', '');
|
||||
const catEntry = catalog[sfId.toLowerCase()] || catalog[sfId];
|
||||
if (catEntry && catEntry.instruments) return { ...sf, presets: catEntry.instruments };
|
||||
return sf;
|
||||
});
|
||||
} catch (e) { console.warn('Catalog fetch error:', e); }
|
||||
setInstrumentSelectorData(data);
|
||||
}).catch(() => {});
|
||||
} catch (e) { }
|
||||
})();
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user