fixes: column data generated from restapi does not render correct columns in viewer (#7695)

This commit is contained in:
Arpit 2023-10-09 16:11:03 +05:30 committed by GitHub
parent ec00a7c48d
commit 4e9762f170
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -55,7 +55,7 @@ import { useDataQueries, useDataQueriesStore } from '@/_stores/dataQueriesStore'
import { useAppVersionStore, useAppVersionActions, useAppVersionState } from '@/_stores/appVersionStore';
import { useQueryPanelStore } from '@/_stores/queryPanelStore';
import { useCurrentStateStore, useCurrentState } from '@/_stores/currentStateStore';
import { computeAppDiff, computeComponentPropertyDiff, resetAllStores } from '@/_stores/utils';
import { computeAppDiff, computeComponentPropertyDiff, isParamFromTableColumn, resetAllStores } from '@/_stores/utils';
import { setCookie } from '@/_helpers/cookie';
import { shallow } from 'zustand/shallow';
import { useEditorActions, useEditorState, useEditorStore } from '@/_stores/editorStore';
@ -801,6 +801,16 @@ const EditorComponent = (props) => {
updateAppDefinitionDiff(diffPatches);
const isParamDiffFromTableColumn = opts?.containerChanges
? isParamFromTableColumn(diffPatches, updatedAppDefinition)
: false;
if (isParamDiffFromTableColumn) {
opts.componentDefinitionChanged = true;
opts.isParamFromTableColumn = true;
delete opts.containerChanges;
}
updateState({
appDiffOptions: opts,
});

View file

@ -95,6 +95,14 @@ function updateValueInJson(json, path, value) {
return json;
}
export function isParamFromTableColumn(appDiff, definition) {
const path = generatePath(appDiff, 'columns') || generatePath(appDiff, 'actions');
const value2 = getValueFromJson(definition, path);
return value2 !== undefined;
}
export const computeComponentPropertyDiff = (appDiff, definition, opts) => {
if (!opts?.isParamFromTableColumn) {
return appDiff;