mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) Improving custom widget API. Changing destroy function signature.
Summary: Destroy function in TableOperations was throwing error when invoked with a single record id instead of an array. Now it returns a void type. Also changing mapColumns function signature as it doesn't require options for a default behavior. Test Plan: Updated tests. Reviewers: alexmojaki Reviewed By: alexmojaki Differential Revision: https://phab.getgrist.com/D3404
This commit is contained in:
@@ -67,15 +67,12 @@ export class TableOperationsImpl implements TableOperations {
|
||||
});
|
||||
}
|
||||
|
||||
public destroy(recordId: Types.RecordId): Promise<Types.RecordId>;
|
||||
public destroy(recordIds: Types.RecordId[]): Promise<Types.RecordId[]>;
|
||||
public async destroy(recordIdOrRecordIds: Types.RecordId|Types.RecordId[]): Promise<Types.RecordId|Types.RecordId[]> {
|
||||
return withRecords(recordIdOrRecordIds, async (recordIds) => {
|
||||
public async destroy(recordIdOrRecordIds: Types.RecordId|Types.RecordId[]): Promise<void> {
|
||||
await withRecords(recordIdOrRecordIds, async (recordIds) => {
|
||||
const tableId = await this._platform.getTableId();
|
||||
const actions = [['BulkRemoveRecord', tableId, recordIds]];
|
||||
const sandboxRes = await this._applyUserActions(
|
||||
tableId, [], actions);
|
||||
return sandboxRes.retValues[0];
|
||||
await this._applyUserActions(tableId, [], actions);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user