Skip to content

Commit

Permalink
fix: add schema to table data view to correctly show cell
Browse files Browse the repository at this point in the history
  • Loading branch information
invisal committed Sep 22, 2023
1 parent f8fb501 commit fa810c2
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ import { EditableQueryResultProvider } from 'renderer/contexts/EditableQueryResu
import QueryResultLoading from '../QueryResultViewer/QueryResultLoading';
import { useDialog } from 'renderer/contexts/DialogProvider';
import CommitChangeToolbarItem from '../QueryResultViewer/CommitChangeToolbarItem';
import { transformResultHeaderUseSchema } from 'libs/TransformResult';
import { useSchema } from 'renderer/contexts/SchemaProvider';

interface TableDataViewerProps {
databaseName: string;
Expand Down Expand Up @@ -137,6 +139,7 @@ export default function TableDataViewer({
databaseName,
tableName,
}: TableDataViewerProps) {
const { schema } = useSchema();
const { runner, common } = useSqlExecute();
const [result, setResult] = useState<QueryResult<Record<string, unknown>>>();
const [refreshCounter, setRefreshCounter] = useState(0);
Expand Down Expand Up @@ -169,7 +172,8 @@ export default function TableDataViewer({
skipProtection: true,
})
.then((result) => {
setResult(result[0].result);
const transformResult = transformResultHeaderUseSchema(result, schema);
setResult(transformResult[0].result);
setLoading(false);
})
.catch((e) => {
Expand Down

0 comments on commit fa810c2

Please sign in to comment.