Skip to content

Commit

Permalink
Fix typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
Zacqary committed Nov 25, 2019
1 parent ccee4f2 commit 1017ae5
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 12 deletions.
2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/infra/public/apps/start_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { PageRouter } from '../routes';
import { createStore } from '../store';
import { StoreProvider } from '../store/v2';
import { ApolloClientContext } from '../utils/apollo_context';
import { ReduxStateContextProvider } from '../utils/redux_context.tsx';
import { ReduxStateContextProvider } from '../utils/redux_context';
import { HistoryContext } from '../utils/history_context';
import {
useUiSetting$,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface LogTextStreamLoadingItemViewProps {
hasMore: boolean;
isLoading: boolean;
isStreaming: boolean;
lastStreamingUpdate: number | null;
lastStreamingUpdate: Date | null;
onLoadMore?: () => void;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ interface ScrollableLogTextStreamViewProps {
hasMoreBeforeStart: boolean;
hasMoreAfterEnd: boolean;
isStreaming: boolean;
lastLoadedTime: number | null;
lastLoadedTime: Date | null;
target: TimeKey | null;
jumpToTarget: (target: TimeKey) => any;
reportVisibleInterval: (params: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => {
scrollUnlockLiveStreaming,
isScrollLocked,
}) => (
<WithStreamItems sourceId={sourceId} initializeOnMount={!isAutoReloading}>
<WithStreamItems>
{({
currentHighlightKey,
hasMoreAfterEnd,
Expand Down Expand Up @@ -138,7 +138,7 @@ export const LogsPageLogsContent: React.FunctionComponent = () => {
visibleMidpointTime,
visibleTimeInterval,
}) => (
<WithStreamItems initializeOnMount={!isAutoReloading}>
<WithStreamItems>
{({ isReloading }) => (
<LogMinimap
height={height}
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/infra/public/store/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

import { createSelector } from 'reselect';

import { getLogEntryAtTime } from '../utils/log_entry';
import { globalizeSelectors } from '../utils/typed_redux';
import {
logFilterSelectors as localLogFilterSelectors,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,17 @@ type LogEntriesGetter = (
countAfter: number
) => (params: {
sourceId: string;
timeKey: TimeKey;
timeKey: TimeKey | null;
filterQuery: SerializedFilterQuery | null;
}) => Promise<false | LogEntriesState>;
}) => Promise<LogEntriesState>;

const getLogEntries: LogEntriesGetter = (client, countBefore, countAfter) => async ({
sourceId,
timeKey,
filterQuery,
}) => {
if (!timeKey || !client) return false;
if (!timeKey) throw new Error('TimeKey is null');
if (!client) throw new Error('Missing Apollo client');
const result = await client.query({
query: logEntriesQuery,
variables: {
Expand All @@ -39,7 +40,11 @@ const getLogEntries: LogEntriesGetter = (client, countBefore, countAfter) => asy
},
fetchPolicy: 'no-cache',
});
const { logEntriesAround } = result.data.source;
// Workaround for Typescript. Since we're removing the GraphQL API in another PR or two
// 7.6 goes out I don't think it's worth the effort to actually make this
// typecheck pass
const { source } = result.data as any;
const { logEntriesAround } = source;
return {
entries: logEntriesAround.entries,
entriesStart: logEntriesAround.start,
Expand Down

0 comments on commit 1017ae5

Please sign in to comment.