Skip to content

Commit

Permalink
remove skip 1 in dataset observable
Browse files Browse the repository at this point in the history
Signed-off-by: Joshua Li <[email protected]>
  • Loading branch information
joshuali925 committed Jul 24, 2024
1 parent 6f77f7f commit 1ec2941
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class DataSetManager {
};

public getUpdates$ = () => {
return this.dataSet$.asObservable().pipe(skip(1));
return this.dataSet$.asObservable();
};

public getDataSet = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,7 @@ export const QueryAssistBar: React.FC<QueryAssistInputProps> = (props) => {
const { generateQuery, loading } = useGenerateQuery();
const [callOutType, setCallOutType] = useState<QueryAssistCallOutType>();
const dismissCallout = () => setCallOutType(undefined);
const [selectedDataSet, setSelectedDataSet] = useState<SimpleDataSet | undefined>(
services.data.query.dataSet.getDataSet()
);
const [selectedDataSet, setSelectedDataSet] = useState<SimpleDataSet>();
const selectedIndex = selectedDataSet?.title;
const previousQuestionRef = useRef<string>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ const mockSimpleDataSet = {
} as SimpleDataSet;

dataSetMock.getUpdates$.mockReturnValue(of(mockSimpleDataSet));
dataSetMock.getDataSet.mockReturnValue(mockSimpleDataSet);

jest.mock('../components', () => ({
QueryAssistBar: jest.fn(() => <div>QueryAssistBar</div>),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { HttpSetup } from 'opensearch-dashboards/public';
import React, { useEffect, useState } from 'react';
import { of } from 'rxjs';
import { distinctUntilChanged, map, startWith, switchMap } from 'rxjs/operators';
import { distinctUntilChanged, map, switchMap } from 'rxjs/operators';
import {
DataPublicPluginSetup,
QueryEditorExtensionConfig,
Expand All @@ -26,7 +26,6 @@ const getAvailableLanguages$ = (
data: DataPublicPluginSetup
) =>
data.query.dataSet.getUpdates$().pipe(
startWith(data.query.dataSet.getDataSet()),
distinctUntilChanged(),
switchMap(async (simpleDataSet) => {
const dataSourceId = simpleDataSet?.dataSourceRef?.id;
Expand Down

0 comments on commit 1ec2941

Please sign in to comment.