(core) Fix error when canceling import

Summary:
If cancel was clicked while a transform section was still being
generated in the Importer, an error was thrown. This refactors
the cancelImportFiles API action to take in the file upload id
in place of the entire DataSourceTransformed parameter, which
contains other values that are irrelevant to canceling. One of those
values, the transform section id, was causing the error to be thrown
since it was momentarily null.

Test Plan: Tested manually.

Reviewers: alexmojaki

Reviewed By: alexmojaki

Differential Revision: https://phab.getgrist.com/D3317
This commit is contained in:
George Gevoian
2022-03-09 16:03:02 -08:00
parent 77a5d31afe
commit f02174eb7e
4 changed files with 7 additions and 9 deletions

View File

@@ -446,10 +446,8 @@ export class Importer extends DisposableWithEvents {
this._resetImportDiffState();
// Formula editor cleanup needs to happen before the hidden tables are removed.
this._formulaEditorHolder.dispose();
if (this._uploadResult) {
await this._docComm.cancelImportFiles(
this._getTransformedDataSource(this._uploadResult), this._getHiddenTableIds());
await this._docComm.cancelImportFiles(this._uploadResult.uploadId, this._getHiddenTableIds());
}
this._screen.close();
this.dispose();