diff --git a/packages/graphic-walker/src/App.tsx b/packages/graphic-walker/src/App.tsx index d298000f..819bc311 100644 --- a/packages/graphic-walker/src/App.tsx +++ b/packages/graphic-walker/src/App.tsx @@ -291,7 +291,7 @@ export function VizAppWithContext(props: IVizAppProps & IComputationProps) { safeMetas, onMetaChange: safeOnMetaChange, } = useMemo(() => { - if (props.dataSource) { + if (data) { return { safeMetas: fields, computation: getComputation(data), diff --git a/packages/graphic-walker/src/Renderer.tsx b/packages/graphic-walker/src/Renderer.tsx index c719024d..a8a0f265 100644 --- a/packages/graphic-walker/src/Renderer.tsx +++ b/packages/graphic-walker/src/Renderer.tsx @@ -286,7 +286,7 @@ export function RendererAppWithContext( safeMetas, onMetaChange: safeOnMetaChange, } = useMemo(() => { - if (props.dataSource) { + if (data) { return { safeMetas: fields, computation: getComputation(data), diff --git a/packages/graphic-walker/src/Table.tsx b/packages/graphic-walker/src/Table.tsx index fe8f504d..ddc626a6 100644 --- a/packages/graphic-walker/src/Table.tsx +++ b/packages/graphic-walker/src/Table.tsx @@ -121,7 +121,7 @@ export function TableAppWithContext(props: ITableProps & IComputationProps) { safeMetas, onMetaChange: safeOnMetaChange, } = useMemo(() => { - if (props.dataSource) { + if (data) { return { safeMetas: fields, computation: getComputation(data), diff --git a/packages/graphic-walker/src/components/leafletRenderer/ChoroplethRenderer.tsx b/packages/graphic-walker/src/components/leafletRenderer/ChoroplethRenderer.tsx index cca0dc3a..afc5e532 100644 --- a/packages/graphic-walker/src/components/leafletRenderer/ChoroplethRenderer.tsx +++ b/packages/graphic-walker/src/components/leafletRenderer/ChoroplethRenderer.tsx @@ -316,7 +316,7 @@ const ChoroplethRenderer = forwardRef
{data[i][geoId.fid]}
{tooltipFields.map((f, j) => ( - + ))} )} @@ -340,7 +340,7 @@ const ChoroplethRenderer = forwardRef
{data[i][geoId.fid]}
{tooltipFields.map((f, j) => ( - + ))} diff --git a/packages/graphic-walker/src/interfaces.ts b/packages/graphic-walker/src/interfaces.ts index 3a2a9032..cfb248ca 100644 --- a/packages/graphic-walker/src/interfaces.ts +++ b/packages/graphic-walker/src/interfaces.ts @@ -975,7 +975,7 @@ export interface ILocalComputationProps { fieldKeyGuard?: boolean; /** @deprecated renamed to data */ dataSource: any[] | Record; - data?: any[]; + data?: any[] | Record; computationTimeout?: number; } diff --git a/packages/graphic-walker/src/models/visSpecHistory.ts b/packages/graphic-walker/src/models/visSpecHistory.ts index 78070c15..99851bd5 100644 --- a/packages/graphic-walker/src/models/visSpecHistory.ts +++ b/packages/graphic-walker/src/models/visSpecHistory.ts @@ -456,7 +456,7 @@ const actions: { }, [Methods.editAllField]: (data, fid, newData, identifier) => { if (Object.keys(newData).includes('name')) { - const originalField = data.encodings.dimensions.concat(data.encodings.measures).find((x) => x.fid === fid); + const originalField = data.encodings.dimensions.concat(data.encodings.measures).find(identifier ? (x) => getFieldIdentifier(x) !== identifier : (x) => x.fid !== fid); // if name is changed, update all computed fields return produce(data, (draft) => { if (!originalField) return; diff --git a/packages/graphic-walker/src/store/visualSpecStore.ts b/packages/graphic-walker/src/store/visualSpecStore.ts index 6bec31d2..7c0f4d49 100644 --- a/packages/graphic-walker/src/store/visualSpecStore.ts +++ b/packages/graphic-walker/src/store/visualSpecStore.ts @@ -41,7 +41,6 @@ import { IDefaultConfig, IJoinPath, FieldIdentifier, - FieldIdentifier, } from '../interfaces'; import { GLOBAL_CONFIG } from '../config'; import { COUNT_FIELD_ID, DATE_TIME_DRILL_LEVELS, DATE_TIME_FEATURE_LEVELS, PAINT_FIELD_ID, MEA_KEY_ID, MEA_VAL_ID, DEFAULT_DATASET } from '../constants'; @@ -582,7 +581,7 @@ export class VizSpecStore { if (!origianlField) { return; } - this.visList[this.visIndex] = performers.editAllField(this.visList[this.visIndex], origianlField.fid, { name: newName }); + this.visList[this.visIndex] = performers.editAllField(this.visList[this.visIndex], origianlField.fid, { name: newName }, getFieldIdentifier(origianlField)); } public createDateTimeDrilledField(