diff --git a/src/app/tabs/compileTab/compilerContainer.js b/src/app/tabs/compileTab/compilerContainer.js index 42ba952a0c..696dbda7bd 100644 --- a/src/app/tabs/compileTab/compilerContainer.js +++ b/src/app/tabs/compileTab/compilerContainer.js @@ -284,18 +284,27 @@ class CompilerContainer { this._updateLanguageSelector() } + _shouldBeAdded(version) { + return !version.includes('nightly') || + (version.includes('nightly') && this._view.includeNightlies.checked) + } + _updateVersionSelector () { + // update selectedversion of previous one got filtered out + if (!this._shouldBeAdded(this.data.selectedVersion)) { + this.data.selectedVersion = this.data.defaultVersion + } this._view.versionSelector.innerHTML = '' this.data.allversions.forEach(build => { const option = build.path === this.data.selectedVersion ? yo`` : yo`` - - if (!option.innerText.includes('nightly') || - (option.innerText.includes('nightly') && this._view.includeNightlies.checked)) { + + if (this._shouldBeAdded(option.innerText)) { this._view.versionSelector.appendChild(option) } }) + this._view.versionSelector.removeAttribute('disabled') this.queryParams.update({ version: this.data.selectedVersion }) let url