Skip to content

Commit

Permalink
fix: remove streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
astandrik committed Jan 27, 2025
1 parent 3a5ac58 commit cb9a2e0
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 16 deletions.
4 changes: 2 additions & 2 deletions src/containers/Tenant/Query/QueryResult/QueryResultViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export function QueryResultViewer({
});
const [useShowPlanToSvg] = useSetting<boolean>(USE_SHOW_PLAN_SVG_KEY);

const {error, isLoading, queryId, data = {}, isStreaming} = result;
const {error, isLoading, queryId, data = {}} = result;
const {preparedPlan, simplifiedPlan, stats, resultSets, ast} = data;

React.useEffect(() => {
Expand Down Expand Up @@ -321,7 +321,7 @@ export function QueryResultViewer({
{renderRightControls()}
</div>
{isLoading || isQueryCancelledError(error) ? null : <QuerySettingsBanner />}
<LoaderWrapper loading={isLoading && !isStreaming}>
<LoaderWrapper loading={isLoading && !data.resultSets}>
<Fullscreen className={b('result')}>{renderResultSection()}</Fullscreen>
</LoaderWrapper>
</React.Fragment>
Expand Down
20 changes: 7 additions & 13 deletions src/store/reducers/query/query.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-param-reassign */
import {createSlice} from '@reduxjs/toolkit';
import type {PayloadAction} from '@reduxjs/toolkit';

Expand Down Expand Up @@ -130,19 +131,15 @@ const slice = createSlice({
setQueryHistoryFilter: (state, action: PayloadAction<string>) => {
state.history.filter = action.payload;
},
setStreamingState: (state, action: PayloadAction<boolean>) => {
if (state.result) {
state.result.isStreaming = action.payload;
if (action.payload) {
state.result.data = prepareQueryData(null);
}
}
},
addStreamingChunk: (state, action: PayloadAction<StreamingChunk>) => {
if (!state.result?.isStreaming || !state.result.data) {
if (!state.result) {
return;
}

if (!state.result.data) {
state.result.data = prepareQueryData(null);
}

const chunk = action.payload;

if (isSessionChunk(chunk)) {
Expand Down Expand Up @@ -173,7 +170,6 @@ const slice = createSlice({
}
}
} else if (isQueryResponseChunk(chunk)) {
state.result.isStreaming = false;
state.result.isLoading = false;

if (state.result.data) {
Expand Down Expand Up @@ -216,7 +212,6 @@ export const {
goToNextQuery,
setTenantPath,
setQueryHistoryFilter,
setStreamingState,
addStreamingChunk,
} = slice.actions;

Expand Down Expand Up @@ -251,7 +246,6 @@ export const queryApi = api.injectEndpoints({
{signal, dispatch},
) => {
dispatch(setQueryResult({type: 'execute', queryId, isLoading: true}));
dispatch(setStreamingState(true));

const {action, syntax} = getActionAndSyntaxFromQueryMode(
'execute',
Expand All @@ -278,7 +272,7 @@ export const queryApi = api.injectEndpoints({
timeout: isNumeric(querySettings.timeout)
? Number(querySettings.timeout) * 1000
: undefined,
output_chunk_max_size: 10000,
output_chunk_max_size: 1000,
},
{
signal,
Expand Down
1 change: 0 additions & 1 deletion src/store/reducers/query/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ export interface QueryResult {
isTraceReady?: true;
queryId: string;
isLoading: boolean;
isStreaming?: boolean;
}

export interface QueryState {
Expand Down

0 comments on commit cb9a2e0

Please sign in to comment.