diff --git a/app/client/components/Importer.ts b/app/client/components/Importer.ts index 895a33ad..7cabed28 100644 --- a/app/client/components/Importer.ts +++ b/app/client/components/Importer.ts @@ -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(); diff --git a/app/common/ActiveDocAPI.ts b/app/common/ActiveDocAPI.ts index acafc2bb..b81b7928 100644 --- a/app/common/ActiveDocAPI.ts +++ b/app/common/ActiveDocAPI.ts @@ -209,7 +209,7 @@ export interface ActiveDocAPI { /** * Cancels import files, cleans up temporary hidden tables and uploads. */ - cancelImportFiles(dataSource: DataSourceTransformed, prevTableIds: string[]): Promise; + cancelImportFiles(uploadId: number, prevTableIds: string[]): Promise; /** * Returns a diff of changes that will be applied to the destination table from `transformRule` diff --git a/app/server/lib/ActiveDoc.ts b/app/server/lib/ActiveDoc.ts index 345a75ec..0d777f30 100644 --- a/app/server/lib/ActiveDoc.ts +++ b/app/server/lib/ActiveDoc.ts @@ -544,9 +544,9 @@ export class ActiveDoc extends EventEmitter { * Param `prevTableIds` is an array of hiddenTableIds as received from previous `importFiles` * call, or empty if there was no previous call. */ - public cancelImportFiles(docSession: DocSession, dataSource: DataSourceTransformed, + public cancelImportFiles(docSession: DocSession, uploadId: number, prevTableIds: string[]): Promise { - return this._activeDocImport.cancelImportFiles(docSession, dataSource, prevTableIds); + return this._activeDocImport.cancelImportFiles(docSession, uploadId, prevTableIds); } /** diff --git a/app/server/lib/ActiveDocImport.ts b/app/server/lib/ActiveDocImport.ts index 93e253dd..0f39ee74 100644 --- a/app/server/lib/ActiveDocImport.ts +++ b/app/server/lib/ActiveDocImport.ts @@ -97,17 +97,17 @@ export class ActiveDocImport { * Cancels import files, removes temporary hidden tables and temporary uploaded files * * @param {ActiveDoc} activeDoc: Instance of ActiveDoc. - * @param {DataSourceTransformed} dataSource: an array of DataSource + * @param {number} uploadId: Identifier for the temporary uploaded file(s) to clean up. * @param {Array} prevTableIds: Array of tableIds as received from previous `importFiles` * call when re-importing with changed `parseOptions`. * @returns {Promise} Promise that's resolved when all actions are applied successfully. */ public async cancelImportFiles(docSession: DocSession, - dataSource: DataSourceTransformed, + uploadId: number, prevTableIds: string[]): Promise { await this._removeHiddenTables(docSession, prevTableIds); this._activeDoc.stopBundleUserActions(docSession); - await globalUploadSet.cleanup(dataSource.uploadId); + await globalUploadSet.cleanup(uploadId); } /**