Fix bug when only one result for call or learn

This commit is contained in:
Ian Keane 2026-06-11 12:59:04 -04:00
parent 58c4dc08f3
commit 1aa0237260

9
app.js
View file

@ -934,7 +934,9 @@ function openCallModal(mode) {
callInstrumentId = null;
callTuningId = null;
renderCallStep();
callModal.showModal();
// showModal() is called inside renderCallStep() only when there are
// multiple options to show — if everything auto-skipped the modal
// never opens and the filter is applied instantly.
}
function renderCallStep() {
@ -942,13 +944,16 @@ function renderCallStep() {
: callStep === 1 ? callGetTunings()
: callGetKeys();
// Skip this screen if there's only one option
// Auto-advance if only one option
if (items.length === 1) {
callSelect(callStep === 2 ? items[0].key : items[0].id,
callStep === 2 ? items[0].modal : null);
return;
}
// Multiple options — open the modal now if not already open
if (!callModal.open) callModal.showModal();
$('call-title').textContent = ['Instrument', 'Tuning', 'Key'][callStep];
$('call-back').hidden = callStep === 0;
const opts = $('call-options');