fix(ui): handle both string and numeric instrument_id formats
On page load, instrument_id from server is already a string ("piano").
After user selection, it's a numeric client_id (61) that needs conversion.
Now checks type before converting to handle both cases correctly.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
2b4bd8b934
commit
ae7a745659
|
|
@ -11,11 +11,13 @@ const JKSessionAudioInputs = ({ myTracks, chat, mixerHelper, isRemote = false })
|
|||
) : (
|
||||
<>
|
||||
{myTracks.map((track, index) => {
|
||||
// Convert client instrument_id to server format for icon lookup
|
||||
// instrument_id is numeric (e.g., 61 for Piano), but icon map uses server strings ("piano")
|
||||
const serverInstrument = track.track?.instrument_id
|
||||
? convertClientInstrumentToServer(track.track.instrument_id)
|
||||
: track.track?.instrument;
|
||||
// Determine the server instrument string for icon lookup
|
||||
// - On page load: instrument_id may be a string from server ("piano")
|
||||
// - After selection: instrument_id is numeric client_id (61) that needs conversion
|
||||
const instrumentId = track.track?.instrument_id;
|
||||
const serverInstrument = typeof instrumentId === 'number'
|
||||
? convertClientInstrumentToServer(instrumentId)
|
||||
: (instrumentId || track.track?.instrument);
|
||||
const instrumentIcon = getInstrumentIcon45_inverted(serverInstrument);
|
||||
return (
|
||||
<div>
|
||||
|
|
|
|||
Loading…
Reference in New Issue