diff --git a/simpletuner/templates/trainer_dataloader_section.html b/simpletuner/templates/trainer_dataloader_section.html index bb330364d..49dca3309 100644 --- a/simpletuner/templates/trainer_dataloader_section.html +++ b/simpletuner/templates/trainer_dataloader_section.html @@ -900,7 +900,7 @@ const trainer = Alpine.store('trainer'); if (trainer) { if (typeof trainer.markDatasetsDirty === 'function') { - trainer.markDatasetsDirty(); + trainer.markDatasetsDirty({ refresh: this.dataLoaderMode !== 'json' }); } else { trainer.hasUnsavedChanges = true; } diff --git a/simpletuner/templates/trainer_htmx.html b/simpletuner/templates/trainer_htmx.html index 735a5ade2..c489db66f 100644 --- a/simpletuner/templates/trainer_htmx.html +++ b/simpletuner/templates/trainer_htmx.html @@ -2074,9 +2074,12 @@ const sanitized = this.prepareDatasetsForSave(); this.dataLoaderJson = JSON.stringify(sanitized, null, 2); }, - markDatasetsDirty() { + markDatasetsDirty(options = {}) { + const { refresh = true } = options || {}; this.hasUnsavedChanges = true; - this.refreshDatasetsJson(); + if (refresh && this.dataLoaderMode !== 'json') { + this.refreshDatasetsJson(); + } }, async loadCaptionFilters(force = false) { if (!force && Array.isArray(this.captionFilters) && this.captionFilters.length > 0) {