Skip to content

Commit

Permalink
fix(Preview): do not auto refresh table preview (#1503)
Browse files Browse the repository at this point in the history
  • Loading branch information
ValeraS authored Oct 21, 2024
1 parent ee06b4e commit dbe83b2
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions src/containers/Tenant/Query/Preview/Preview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {previewApi} from '../../../../store/reducers/preview';
import {setShowPreview} from '../../../../store/reducers/schema/schema';
import type {EPathType} from '../../../../types/api/schema';
import {cn} from '../../../../utils/cn';
import {useAutoRefreshInterval, useTypedDispatch} from '../../../../utils/hooks';
import {useTypedDispatch} from '../../../../utils/hooks';
import {parseQueryErrorToString} from '../../../../utils/query';
import {isExternalTableType, isTableType} from '../../utils/schema';
import i18n from '../i18n';
Expand All @@ -28,13 +28,10 @@ export const Preview = ({database, path, type}: PreviewProps) => {

const isPreviewAvailable = isTableType(type);

const [autoRefreshInterval] = useAutoRefreshInterval();

const query = `select * from \`${path}\` limit 32`;
const {currentData, isFetching, error} = previewApi.useSendQueryQuery(
{database, query, action: isExternalTableType(type) ? 'execute-query' : 'execute-scan'},
{
pollingInterval: autoRefreshInterval,
skip: !isPreviewAvailable,
refetchOnMountOrArgChange: true,
},
Expand Down

0 comments on commit dbe83b2

Please sign in to comment.