Skip to content

An open source alternative to Tableau. Embeddable visual analytic

fix: dataset switch leads to view meta change

ObservedObserverc1f5cc6fbb0c
diff --git a/packages/graphic-walker/src/segments/segmentNav.tsx b/packages/graphic-walker/src/segments/segmentNav.tsx
index ebddaebc..1e658115 100644
--- a/packages/graphic-walker/src/segments/segmentNav.tsx
+++ b/packages/graphic-walker/src/segments/segmentNav.tsx
@@ -1,18 +1,14 @@
-import React, { Fragment, useCallback } from "react";
+import React, { useCallback } from "react";
import { observer } from "mobx-react-lite";
import DefaultTab, { ITabOption } from "../components/tabs/defaultTab";
import { useGlobalStore } from "../store";
-import { ChartBarIcon, ChartPieIcon, CircleStackIcon } from "@heroicons/react/24/outline";
+import { ChartPieIcon, CircleStackIcon } from "@heroicons/react/24/outline";
import { ISegmentKey } from "../interfaces";
import { useTranslation } from "react-i18next";
-
-const ADD_KEY = '_add';
-
const SegmentNav: React.FC = (props) => {
const { vizStore, commonStore } = useGlobalStore();
- const { visIndex, visList } = vizStore;
- const { currentDataset, segmentKey } = commonStore;
+ const { segmentKey } = commonStore;
const { t } = useTranslation();
const tabs: ITabOption[] = [
@@ -30,15 +26,6 @@ const SegmentNav: React.FC = (props) => {
}
]
- const visSelectionHandler = useCallback((tabKey: string, tabIndex: number) => {
- if (tabKey === ADD_KEY) {
- vizStore.addVisualization();
- vizStore.initMetaState(currentDataset)
- } else {
- vizStore.selectVisualization(tabIndex);
- }
- }, [currentDataset, vizStore])
-
const editLabelHandler = useCallback((content: string, tabIndex: number) => {
vizStore.setVisName(tabIndex, content)
}, [])
diff --git a/packages/graphic-walker/src/store/commonStore.ts b/packages/graphic-walker/src/store/commonStore.ts
index 17f5cbca..7719e1ab 100644
--- a/packages/graphic-walker/src/store/commonStore.ts
+++ b/packages/graphic-walker/src/store/commonStore.ts
@@ -176,7 +176,7 @@ export class CommonStore {
}
public createPlaceholderDS() {
this.addDS({
- name: '新数据源',
+ name: 'new dataset',
dataSource: [],
rawFields: []
})
diff --git a/packages/graphic-walker/src/store/visualSpecStore.ts b/packages/graphic-walker/src/store/visualSpecStore.ts
index f9fd24a2..6dd4361c 100644
--- a/packages/graphic-walker/src/store/visualSpecStore.ts
+++ b/packages/graphic-walker/src/store/visualSpecStore.ts
@@ -151,13 +151,6 @@ export class VizSpecStore {
reactions: false,
});
this.reactions.push(
- reaction(
- () => commonStore.currentDataset,
- (dataset) => {
- // this.initState();
- this.initMetaState(dataset);
- }
- ),
reaction(
() => this.visList[this.visIndex],
(frame) => {
@@ -712,7 +705,6 @@ export class VizSpecStore {
this.commonStore.datasets = content.datasets;
this.commonStore.dataSources = content.dataSources;
this.commonStore.dsIndex = Math.max(content.datasets.length - 1, 0);
- // 补上初始化新版本特性
this.visList = parseGWPureSpec(forwardVisualConfigs(content.specList));
this.visIndex = 0;
}