Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,26 +99,21 @@ const {
widgetId: computed(() => widgetGenerateState.widgetId),
});

let fieldManager: WidgetFieldValueManager;

const state = reactive({
isPrivate: computed<boolean>(() => !!widgetGenerateState.widgetId?.startsWith('private')),
selectedDataTable: computed<DataTableModel|undefined>(() => dataTableList.value.find((d) => d.data_table_id === widgetGenerateState.selectedDataTableId)),
mounted: false,
fieldManager: computed<WidgetFieldValueManager|undefined>(() => {
const _widgetConfig = getWidgetConfig(widgetGenerateState.selectedWidgetName);

if (
!widgetGenerateState.selectedWidgetName
|| widgetLoading.value
|| !widget.value
|| !state.selectedDataTable
|| !_widgetConfig
) return undefined;

return new WidgetFieldValueManager(
_widgetConfig,
state.selectedDataTable,
cloneDeep(widget.value?.options) || {},
);
if (!fieldManager && widget.value) {
fieldManager = new WidgetFieldValueManager(
state.widgetConfig,
state.selectedDataTable,
cloneDeep(widget.value?.options) || {},
);
}
return fieldManager;
}),
value: computed(() => state.fieldManager?.data?.granularity),
widgetConfig: computed(() => getWidgetConfig(widgetGenerateState.selectedWidgetName)),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const state = reactive({
label: d.name,
icon: d.data_type === DATA_TABLE_TYPE.TRANSFORMED ? 'ic_transform-data' : 'ic_service_data-sources',
}))),
selectedDataTableId: computed<string>(() => widgetGenerateState.selectedDataTableId),
selectedDataTableId: computed<string|undefined>(() => widgetGenerateState.selectedDataTableId),
errorModalCurrentType: undefined as 'default'|'geoMap'|undefined,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ export const useDataTableCascadeUpdate = ({ widgetId }: UseDataTableCascadeUpdat
};

const cascadeUpdateDataTable = async (dataTableId: string) => {
const children = _state.dataTableReferenceMap[dataTableId].children;
return children.reduce((chain, childId) => chain.then(async () => {
const children = _state.dataTableReferenceMap[dataTableId]?.children;
return children?.reduce((chain, childId) => chain.then(async () => {
try {
widgetGenerateStore.setDataTableCasCadeUpdateLoadingMap({
...widgetGenerateState.dataTableCasCadeUpdateLoadingMap,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ export const useWidgetDataTableListQuery = ({

/* Query Keys */
const { key: publicDataTableListQueryKey, params: publicDataTableListParams } = useServiceQueryKey('dashboard', 'public-data-table', 'list', {
contextKey: widgetId.value,
contextKey: computed(() => widgetId.value),
params: computed<DataTableListParameters>(() => ({
widget_id: widgetId.value as string,
})),
});
const { key: privateDataTableListQueryKey, params: privateDataTableListParams } = useServiceQueryKey('dashboard', 'private-data-table', 'list', {
contextKey: widgetId.value,
contextKey: computed(() => widgetId.value),
params: computed<DataTableListParameters>(() => ({
widget_id: widgetId.value as string,
})),
Expand Down
Loading