diff --git a/lib/Toolbar.js b/lib/Toolbar.js index de7c8445..130ecab2 100644 --- a/lib/Toolbar.js +++ b/lib/Toolbar.js @@ -114,7 +114,6 @@ class Toolbar { const $fileInput = $('#open-file-input'); $fileInput.on('change', function () { - const dh = self.context.getCurrentDataHarmonizer() const file = $fileInput[0].files[0]; const ext = file.name.split('.').pop(); const acceptedExts = ['xlsx', 'xls', 'tsv', 'csv', 'json']; @@ -123,18 +122,18 @@ class Toolbar { $('#open-err-msg').text(errMsg); $('#open-error-modal').modal('show'); } else { - dh.invalid_cells = {}; // open for all data harmonizers + // TODO: refactor to context function, there's too much redundant work being done here Object.values(self.context.dhs).forEach(dh => { + dh.invalid_cells = {}; dh.runBehindLoadingScreen(dh.openFile.bind(dh), [file]); + dh.current_selection = [null, null, null, null]; }) $('#file_name_display').text(file.name); } // Allow consecutive uploads of the same file $fileInput[0].value = ''; - self.hideValidationResultButtons(); - dh.current_selection = [null, null, null, null]; }); // File -> Save