Skip to content

Commit

Permalink
Replace firstValueFrom with lastValueFrom
Browse files Browse the repository at this point in the history
  • Loading branch information
kertal committed Jun 17, 2022
1 parent 1eeb0d8 commit 4957571
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/plugins/discover/public/utils/use_es_doc_search.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import { useCallback, useEffect, useMemo, useState } from 'react';
import type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey';
import { firstValueFrom } from 'rxjs';
import { lastValueFrom } from 'rxjs';
import { DataView } from '@kbn/data-views-plugin/public';
import { DocProps } from '../application/doc/components/doc';
import { ElasticRequestState } from '../application/doc/types';
Expand Down Expand Up @@ -75,7 +75,7 @@ export function useEsDocSearch({

const requestData = useCallback(async () => {
try {
const { rawResponse } = await firstValueFrom(
const { rawResponse } = await lastValueFrom(
data.search.search({
params: {
index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import React, { useState, Fragment, useEffect, useCallback } from 'react';
import { firstValueFrom } from 'rxjs';
import { lastValueFrom } from 'rxjs';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n-react';

Expand Down Expand Up @@ -141,7 +141,7 @@ export const EsQueryExpression = ({
const timeWindow = parseDuration(window);
const parsedQuery = JSON.parse(esQuery);
const now = Date.now();
const { rawResponse } = await firstValueFrom(
const { rawResponse } = await lastValueFrom(
data.search.search({
params: buildSortedEventsQuery({
index,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import React, { Fragment, useCallback, useEffect, useMemo, useReducer, useState } from 'react';
import deepEqual from 'fast-deep-equal';
import { firstValueFrom } from 'rxjs';
import { lastValueFrom } from 'rxjs';
import { Filter } from '@kbn/es-query';
import { FormattedMessage } from '@kbn/i18n-react';
import { EuiSpacer, EuiTitle } from '@elastic/eui';
Expand Down Expand Up @@ -183,7 +183,7 @@ export const SearchSourceExpressionForm = (props: SearchSourceExpressionFormProp
'filter',
timeFilter ? [timeFilter, ...ruleConfiguration.filter] : ruleConfiguration.filter
);
const { rawResponse } = await firstValueFrom(testSearchSource.fetch$());
const { rawResponse } = await lastValueFrom(testSearchSource.fetch$());
return { nrOfDocs: totalHitsToNumber(rawResponse.hits.total), timeWindow };
}, [searchSource, timeWindowSize, timeWindowUnit, ruleConfiguration]);

Expand Down

0 comments on commit 4957571

Please sign in to comment.