Browse Source

ref(js): A few more miscellaneous unnecessary async keywords (#35301)

Evan Purkhiser 2 years ago
parent
commit
e18ecd1ce5

+ 1 - 1
static/app/actionCreators/onboardingTasks.tsx

@@ -9,7 +9,7 @@ import {OnboardingTask, Organization} from 'sentry/types';
  * If no API client is provided the task will not be updated on the server side
  * and will only update in the organization store.
  */
-export async function updateOnboardingTask(
+export function updateOnboardingTask(
   api: Client | null,
   organization: Organization,
   updatedTask: Partial<Pick<OnboardingTask, 'status' | 'data'>> & {

+ 2 - 2
static/app/utils/performance/contexts/genericQueryBatcher.tsx

@@ -48,7 +48,7 @@ function queriesToMap(collectedQueries: Record<symbol, BatchQueryDefinition>) {
   }
   const mergeMap: MergeMap = {};
 
-  keys.forEach(async key => {
+  keys.forEach(key => {
     const query = collectedQueries[key];
     mergeMap[mergeKey(query)] = mergeMap[mergeKey(query)] || [];
     mergeMap[mergeKey(query)].push(query);
@@ -73,7 +73,7 @@ function _handleUnmergeableQuery(queryDefinition: BatchQueryDefinition) {
 
 function _handleUnmergeableQueries(mergeMap: MergeMap) {
   let queriesSent = 0;
-  Object.keys(mergeMap).forEach(async k => {
+  Object.keys(mergeMap).forEach(k => {
     // Using async forEach to ensure calls start in parallel.
     const mergeList = mergeMap[k];
 

+ 1 - 5
static/app/utils/performanceForSentry.tsx

@@ -51,11 +51,7 @@ export class PerformanceInteraction {
     return PerformanceInteraction.interactionTransaction;
   }
 
-  static async startInteraction(
-    name: string,
-    timeout = INTERACTION_TIMEOUT,
-    immediate = true
-  ) {
+  static startInteraction(name: string, timeout = INTERACTION_TIMEOUT, immediate = true) {
     try {
       const currentIdleTransaction = getCurrentSentryReactTransaction();
       if (currentIdleTransaction) {

+ 1 - 1
static/app/views/dashboardsV2/widgetCard/releaseWidgetQueries.tsx

@@ -288,7 +288,7 @@ class ReleaseWidgetQueries extends Component<Props, State> {
     this.fetchData();
   }
 
-  async fetchData() {
+  fetchData() {
     const {selection, api, organization, widget, includeAllArgs, cursor, onDataFetched} =
       this.props;
 

+ 7 - 7
tests/js/spec/components/organizations/globalSelectionHeader.spec.jsx

@@ -516,7 +516,7 @@ describe('GlobalSelectionHeader', function () {
     expect(initializationObj.router.replace).not.toHaveBeenCalled();
   });
 
-  it('updates store with default values when there are no query params in URL', async function () {
+  it('updates store with default values when there are no query params in URL', function () {
     const initializationObj = initializeOrg({
       organization: {
         features: ['global-views'],
@@ -615,7 +615,7 @@ describe('GlobalSelectionHeader', function () {
    * in URL).
    */
   describe('Single project selection mode', function () {
-    it('does not do anything while organization is switching in single project', async function () {
+    it('does not do anything while organization is switching in single project', function () {
       const initialData = initializeOrg({
         organization: {slug: 'old-org-slug'},
         router: {
@@ -697,7 +697,7 @@ describe('GlobalSelectionHeader', function () {
       );
     });
 
-    it('selects first project if none (i.e. all) is requested', async function () {
+    it('selects first project if none (i.e. all) is requested', function () {
       const project = TestStubs.Project({id: '3'});
       const org = TestStubs.Organization({projects: [project]});
 
@@ -884,7 +884,7 @@ describe('GlobalSelectionHeader', function () {
         initialData.router.replace.mockClear();
       });
 
-      it('uses first project in org projects when mounting', async function () {
+      it('uses first project in org projects when mounting', function () {
         createWrapper();
 
         // Projects are returned in sorted slug order, so `prod-project` would
@@ -895,7 +895,7 @@ describe('GlobalSelectionHeader', function () {
         });
       });
 
-      it('appends projectId to URL when `forceProject` becomes available (async)', async function () {
+      it('appends projectId to URL when `forceProject` becomes available (async)', function () {
         ProjectsStore.reset();
 
         // forceProject generally starts undefined
@@ -918,7 +918,7 @@ describe('GlobalSelectionHeader', function () {
         expect(initialData.router.replace).toHaveBeenCalledTimes(1);
       });
 
-      it('does not append projectId to URL when `forceProject` becomes available but project id already exists in URL', async function () {
+      it('does not append projectId to URL when `forceProject` becomes available but project id already exists in URL', function () {
         // forceProject generally starts undefined
         createWrapper({shouldForceProject: true});
 
@@ -942,7 +942,7 @@ describe('GlobalSelectionHeader', function () {
         expect(initialData.router.replace).not.toHaveBeenCalled();
       });
 
-      it('appends projectId to URL when mounted with `forceProject`', async function () {
+      it('appends projectId to URL when mounted with `forceProject`', function () {
         // forceProject generally starts undefined
         createWrapper({
           shouldForceProject: true,