Skip to content

Commit

Permalink
[CI] Auto-commit changed files from 'node scripts/precommit_hook.js -…
Browse files Browse the repository at this point in the history
…-ref HEAD~1..HEAD --fix'
  • Loading branch information
kibanamachine committed Sep 29, 2023
1 parent 27579da commit 4d8fd88
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const tabs = [
name: 'Tab2',
label: 'Tab2',
component: null,
}
},
];

describe('getNextTab', () => {
Expand All @@ -50,7 +50,7 @@ describe('getNextTab', () => {
name: 'noLongerAvailableTab',
label: 'noLongerAvailableTab',
component: null,
}
};
test('should return first tab when preferred tabs are not requested', () => {
expect(getNextTab(currentTab, tabs)).toEqual(tabs[0]);
});
Expand All @@ -59,4 +59,4 @@ describe('getNextTab', () => {
expect(getNextTab(currentTab, tabs, ['tab1'])).toEqual(tabs[0]);
});
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@

import type { DetailViewData } from './types';

export function getNextTab(currentTab: DetailViewData | null, tabs: DetailViewData[], preferredTabs?: string[]) {
export function getNextTab(
currentTab: DetailViewData | null,
tabs: DetailViewData[],
preferredTabs?: string[]
) {
const firstTab = tabs.length ? tabs[0] : null;
if (currentTab || !preferredTabs) {
return firstTab;
Expand All @@ -23,4 +27,3 @@ export function getNextTab(currentTab: DetailViewData | null, tabs: DetailViewDa

return preferredTab ? preferredTab : firstTab;
}

Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export function RequestDetails(props: Props) {
}

setSelectedDetail(getNextTab(selectedDetail, nextAvailableDetails, props.initialTabs));

// do not re-run on selectedDetail change
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [props.initialTabs, props.request]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export interface DetailViewData {
name: string;
label: string;
component: any;
}
}

0 comments on commit 4d8fd88

Please sign in to comment.