mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Merge branch 'feat/grid-appbuilder-improvement' of https://github.com/ToolJet/ToolJet into feat/grid-appbuilder-improvement
This commit is contained in:
commit
e3154a2083
2 changed files with 8 additions and 4 deletions
|
|
@ -183,6 +183,8 @@ function getDynamicVariables(text) {
|
|||
const resolveMultiDynamicReferences = (code, lookupTable) => {
|
||||
let resolvedValue = code;
|
||||
|
||||
const isComponentValue = code.includes('components.') || false;
|
||||
|
||||
const allDynamicVariables = getDynamicVariables(code);
|
||||
|
||||
if (allDynamicVariables) {
|
||||
|
|
@ -191,13 +193,14 @@ const resolveMultiDynamicReferences = (code, lookupTable) => {
|
|||
|
||||
const { toResolveReference } = inferJSExpAndReferences(variableToResolve, lookupTable.hints);
|
||||
|
||||
if (toResolveReference && lookupTable.hints.has(toResolveReference)) {
|
||||
if (!isComponentValue && toResolveReference && lookupTable.hints.has(toResolveReference)) {
|
||||
const idToLookUp = lookupTable.hints.get(variableToResolve);
|
||||
const res = lookupTable.resolvedRefs.get(idToLookUp);
|
||||
|
||||
resolvedValue = resolvedValue.replace(variable, res);
|
||||
} else {
|
||||
const [resolvedCode] = resolveCode(variableToResolve, lookupTable, {}, true, [], true);
|
||||
const currentState = useCurrentStateStore.getState();
|
||||
const [resolvedCode] = resolveCode(variableToResolve, currentState, {}, true, [], true);
|
||||
|
||||
resolvedValue = resolvedCode;
|
||||
}
|
||||
|
|
@ -242,8 +245,8 @@ export const resolveReferences = (query, validationSchema, customResolvers = {},
|
|||
}
|
||||
|
||||
const { toResolveReference, jsExpression, jsExpMatch } = inferJSExpAndReferences(value, lookupTable.hints);
|
||||
|
||||
if (!jsExpMatch && toResolveReference && lookupTable.hints.has(toResolveReference)) {
|
||||
const isComponentValue = toResolveReference?.startsWith('components.') || false; //!Notes: As we removed the updating of references on currentState changes, exposed variable of components are dynamic and cannot be controlled in any form, so we are resolving only components references with our legacy approach.
|
||||
if (!isComponentValue && !jsExpMatch && toResolveReference && lookupTable.hints.has(toResolveReference)) {
|
||||
const idToLookUp = lookupTable.hints.get(toResolveReference);
|
||||
resolvedValue = lookupTable.resolvedRefs.get(idToLookUp);
|
||||
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ export const useDataQueriesStore = create(
|
|||
set({ dataQueries });
|
||||
if (type === 'mappingUpdate') {
|
||||
const { actions } = useQueryPanelStore.getState();
|
||||
actions.setSelectedQuery(null);
|
||||
const queryId = dataQueries[0]?.id;
|
||||
|
||||
actions.setSelectedQuery(queryId);
|
||||
|
|
|
|||
Loading…
Reference in a new issue