message: Fixed issue where mods that were already inserted were sometimes not available to lock.
diff: @@ -2,7 +2,12 @@ import React from 'react';
  import Sheet from '../dim-ui/Sheet';
  import SearchFilterInput from '../search/SearchFilterInput';
  import '../item-picker/ItemPicker.scss';
  -import { DestinyInventoryItemDefinition, DestinyClass, TierType } from 'bungie-api-ts/destiny2';
  +import {
  + DestinyInventoryItemDefinition,
  + DestinyClass,
  + TierType,
  + DestinyPlugRuleDefinition
  +} from 'bungie-api-ts/destiny2';
  import { InventoryBuckets, InventoryBucket } from 'app/inventory/inventory-buckets';
  import { LockableBuckets, LockedItemType, BurnItem, LockedMap, ItemsByBucket } from './types';
  import _ from 'lodash';
  @@ -31,6 +36,10 @@ import { escapeRegExp } from 'app/search/search-filters';
  import { D2ManifestDefinitions } from 'app/destiny2/d2-definitions';
  import { SocketDetailsMod } from 'app/item-popup/SocketDetails';
  +const alreadyInsertedRule: DestinyPlugRuleDefinition = {
  + failureMessage: 'Similar mod already applied.'
  +};
  +
  const burns: BurnItem[] = [
  {
  dmg: 'arc',
  @@ -124,6 +133,18 @@ function mapStateToProps() {
  }
  );
  + function getAlreadyInsertedIndex(plugSetItem, defs) {
  + let alreadyInsertedIndex;
  +
  + defs.InventoryItem.get(plugSetItem.plugItemHash)?.plug.insertionRules.forEach((rule, index) => {
  + if (rule.failureMessage === alreadyInsertedRule.failureMessage) {
  + alreadyInsertedIndex = index;
  + }
  + });
  +
  + return alreadyInsertedIndex;
  + }
  +
  /** Build the hashes of all plug set item hashes that are unlocked by any character/profile. */
  const unlockedPlugsSelector = createSelector(
  profileResponseSelector,
  @@ -171,7 +192,10 @@ function mapStateToProps() {
  for (const plugSetHash of sets) {
  const plugSetItems = itemsForPlugSet(profileResponse, plugSetHash);
  for (const plugSetItem of plugSetItems) {
  - if (plugSetItem.canInsert) {
  + if (
  + plugSetItem.canInsert ||
  + plugSetItem.insertFailIndexes.includes(getAlreadyInsertedIndex(plugSetItem, defs))
  + ) {
  unlockedPlugs[plugSetItem.plugItemHash] = plugSetHash;
  }
  }
  