fix: consistently use index (#4196)

This commit is contained in:
Dimitri Mitropoulos 2021-11-10 01:11:31 -05:00 committed by GitHub
parent bfc19844e7
commit 8e21f26175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 12 deletions

View File

@ -356,8 +356,8 @@ export async function getRenderContext(
// Get Keys from ancestors (e.g. Folders)
if (ancestors) {
for (let idx = 0; idx < ancestors.length; idx++) {
const ancestor: any = ancestors[idx] || {};
for (let index = 0; index < ancestors.length; index++) {
const ancestor: any = ancestors[index] || {};
if (
isRequestGroup(ancestor) &&

View File

@ -362,9 +362,9 @@ export class WorkspaceEnvironmentsEditModal extends PureComponent<Props, State>
// Do this last so we don't block the sorting
db.bufferChanges();
Promise.all(newSubEnvironments.map((environment, idx) => this._updateEnvironment(
Promise.all(newSubEnvironments.map((environment, index) => this._updateEnvironment(
environment,
{ metaSortKey: idx },
{ metaSortKey: index },
false,
))).then(() => {
db.flushChanges();

View File

@ -82,9 +82,9 @@ export class Shortcuts extends PureComponent<Props> {
const { hotKeyRegistry, handleUpdateKeyBindings } = this.props;
const keyCombs = getPlatformKeyCombinations(hotKeyRegistry[hotKeyRefId]);
let toBeRemovedIndex = -1;
keyCombs.forEach((existingKeyComb, idx) => {
keyCombs.forEach((existingKeyComb, index) => {
if (areSameKeyCombinations(existingKeyComb, keyComb)) {
toBeRemovedIndex = idx;
toBeRemovedIndex = index;
}
});
@ -105,18 +105,18 @@ export class Shortcuts extends PureComponent<Props> {
handleUpdateKeyBindings(newDefaultRegistry());
}
renderHotKey(def: HotKeyDefinition, i: number) {
renderHotKey(def: HotKeyDefinition, index: number) {
const keyBindings = this.props.hotKeyRegistry[def.id];
const keyCombinations = getPlatformKeyCombinations(keyBindings);
const hasRemoveItems = keyCombinations.length > 0;
const hasResetItems = !areKeyBindingsSameAsDefault(def.id, keyBindings);
return (
<tr key={i}>
<tr key={index}>
<td>{def.description}</td>
<td className="text-right">
{keyCombinations.map((keyComb: KeyCombination, idx: number) => {
{keyCombinations.map((keyComb: KeyCombination, index: number) => {
return (
<code key={idx} className="margin-left-sm">
<code key={index} className="margin-left-sm">
<Hotkey keyCombination={keyComb} />
</code>
);
@ -181,8 +181,8 @@ export class Shortcuts extends PureComponent<Props> {
</div>
<table className="table--fancy">
<tbody>
{HOT_KEY_DEFS.map((def: HotKeyDefinition, idx: number) => {
return this.renderHotKey(def, idx);
{HOT_KEY_DEFS.map((def: HotKeyDefinition, index: number) => {
return this.renderHotKey(def, index);
})}
</tbody>
</table>