patch: fixes extra ajax call on movie options page

This commit is contained in:
2025-05-01 16:35:12 -05:00
parent b23d8a2ba3
commit f3285ba60c

View File

@@ -18,13 +18,15 @@ export default class extends Controller {
static targets = ['list'] static targets = ['list']
options = [] options = []
optionsLoaded = false
async connect() { async connect() {
await this.setOptions(); await this.setOptions();
} }
async setOptions() { async setOptions() {
if (this.options.length === 0) { if (false === this.optionsLoaded) {
this.optionsLoaded = true;
await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`) await fetch(`/torrentio/movies/${this.tmdbIdValue}/${this.imdbIdValue}`)
.then(res => res.text()) .then(res => res.text())
.then(response => { .then(response => {