Skip to content

Commit

Permalink
Collection, TreeView, FileManager: get rid of unused this._selectionC…
Browse files Browse the repository at this point in the history
…hangePromise (#28862)

Signed-off-by: Anton Kuznetsov <[email protected]>
  • Loading branch information
ksercs authored Jan 29, 2025
1 parent faf7b43 commit bf7f61f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -545,8 +545,6 @@ class CollectionWidget<
const { addedItemKeys, removedItemKeys } = args;

if (this._rendered && (addedItemKeys.length || removedItemKeys.length)) {
// @ts-expect-error ts-error
const selectionChangePromise = this._selectionChangePromise;
if (!this._rendering) {
const addedSelection = [];
const removedSelection = [];
Expand Down Expand Up @@ -574,12 +572,9 @@ class CollectionWidget<
this._updateSelection(addedSelection, removedSelection);
}

// eslint-disable-next-line @typescript-eslint/no-floating-promises
when(selectionChangePromise).done(() => {
this._actions.onSelectionChanged({
addedItems: args.addedItems,
removedItems: args.removedItems,
});
this._actions.onSelectionChanged({
addedItems: args.addedItems,
removedItems: args.removedItems,
});
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,9 @@ const TreeViewBase = (HierarchicalCollectionWidget as any).inherit({
_syncSelectionOptions: asyncNoop,

_fireSelectionChanged() {
const selectionChangePromise = this._selectionChangePromise;
when(selectionChangePromise).done(() => {
this._createActionByOption('onSelectionChanged', {
excludeValidators: ['disabled', 'readOnly'],
})();
});
this._createActionByOption('onSelectionChanged', {
excludeValidators: ['disabled', 'readOnly'],
})();
},

_createSelectAllValueChangedAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { getOuterWidth, getOuterHeight, getInnerWidth, getInnerHeight } from '..
import $ from '../../core/renderer';
import { extend } from '../../core/utils/extend';
import { isDefined } from '../../core/utils/type';
import { Deferred, when } from '../../core/utils/deferred';
import { Deferred } from '../../core/utils/deferred';

import holdEvent from '../../common/core/events/hold';
import { addNamespace, isCommandKeyPressed } from '../../common/core/events/utils/index';
Expand Down Expand Up @@ -284,7 +284,6 @@ class FileManagerThumbnailListBox extends CollectionWidget {
const removedItemKeys = args.removedItemKeys;

if(this._rendered && (addedItemKeys.length || removedItemKeys.length)) {
const selectionChangePromise = this._selectionChangePromise;
if(!this._rendering) {
const addedSelection = [];
let normalizedIndex;
Expand All @@ -309,7 +308,7 @@ class FileManagerThumbnailListBox extends CollectionWidget {
this._updateSelection(addedSelection, removedSelection);
}

when(selectionChangePromise).done(() => this._fireSelectionChangeEvent(args));
this._fireSelectionChangeEvent(args);
}
}

Expand Down

0 comments on commit bf7f61f

Please sign in to comment.