Skip to content

Commit

Permalink
fix: preview datasets
Browse files Browse the repository at this point in the history
  • Loading branch information
islxyqwe committed Apr 12, 2024
1 parent 0e2b6e0 commit 805313d
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions packages/graphic-walker/src/components/linkDataset/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Button } from '../ui/button';
import { useTranslation } from 'react-i18next';
import { ArrowRightIcon } from '@heroicons/react/24/outline';
import { IComputationFunction, IJoinPath } from '@/interfaces';
import { addJoinForQuery } from '@/utils/workflow';
import { addJoinForQuery, changeDatasetForQuery } from '@/utils/workflow';
import DataTable from '../dataTable';
import { getFieldIdentifier } from '@/utils';

Expand All @@ -19,20 +19,23 @@ const Preview = observer(function Preview({ path }: { path: IJoinPath }) {
const transformedComputation = useMemo((): IComputationFunction => {
return (query) =>
computation(
addJoinForQuery(query, [
{
type: 'join',
foreigns: [
{
type: 'inner',
keys: [
{ as: 'left', dataset: path.from, field: path.fid },
{ as: 'right', dataset: path.to, field: path.tid },
],
},
],
},
])
changeDatasetForQuery(
addJoinForQuery(query, [
{
type: 'join',
foreigns: [
{
type: 'inner',
keys: [
{ as: 'left', dataset: path.from, field: path.fid },
{ as: 'right', dataset: path.to, field: path.tid },
],
},
],
},
]),
[path.from, path.to]
)
);
}, [computation, path]);
const meta = useMemo(
Expand Down

0 comments on commit 805313d

Please sign in to comment.