Update JackServerSettingsDialog.tsx
The dialog now disables the device selectors and shows a “Loading…” placeholder until ALSA devices are available, preventing runtime errors during the initial render
This commit is contained in:
@@ -462,11 +462,12 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
id="jsd_inputDevice"
|
id="jsd_inputDevice"
|
||||||
value={this.state.jackServerSettings.alsaInputDevice}
|
value={this.state.jackServerSettings.alsaInputDevice}
|
||||||
onChange={e => this.handleInputDeviceChanged(e)}
|
onChange={e => this.handleInputDeviceChanged(e)}
|
||||||
|
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
|
||||||
style={{ width: 220 }}
|
style={{ width: 220 }}
|
||||||
>
|
>
|
||||||
{this.state.alsaDevices!.map(d => (
|
{this.state.alsaDevices?.map(d => (
|
||||||
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
||||||
))}
|
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
|
||||||
@@ -477,11 +478,12 @@ const JackServerSettingsDialog = withStyles(
|
|||||||
id="jsd_outputDevice"
|
id="jsd_outputDevice"
|
||||||
value={this.state.jackServerSettings.alsaOutputDevice}
|
value={this.state.jackServerSettings.alsaOutputDevice}
|
||||||
onChange={e => this.handleOutputDeviceChanged(e)}
|
onChange={e => this.handleOutputDeviceChanged(e)}
|
||||||
|
disabled={!this.state.alsaDevices || this.state.alsaDevices.length === 0}
|
||||||
style={{ width: 220 }}
|
style={{ width: 220 }}
|
||||||
>
|
>
|
||||||
{this.state.alsaDevices!.map(d => (
|
{this.state.alsaDevices?.map(d => (
|
||||||
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
<MenuItem key={d.id} value={d.id}>{d.name}</MenuItem>
|
||||||
))}
|
)) || <MenuItem value="" disabled>Loading...</MenuItem>}
|
||||||
</Select>
|
</Select>
|
||||||
</FormControl>
|
</FormControl>
|
||||||
</div><div>
|
</div><div>
|
||||||
|
|||||||
Reference in New Issue
Block a user