fix: data scope report error with invalid variables (#2811)
* fix: data scope error with invalidate variables * fix: data scope error with invalidate variables
This commit is contained in:
parent
9311b4730a
commit
49f4d1828d
@ -32,7 +32,7 @@ export const filterAnalyses = (filters): any[] => {
|
||||
return true;
|
||||
}
|
||||
const regex = /\{\{\$(?:[a-zA-Z_]\w*)\.([a-zA-Z_]\w*)(?:\.id)?\}\}/;
|
||||
const fieldName = jsonlogic?.value.match(regex)?.[1];
|
||||
const fieldName = jsonlogic?.value.match?.(regex)?.[1];
|
||||
if (fieldName) {
|
||||
results.push(fieldName);
|
||||
}
|
||||
|
@ -71,7 +71,7 @@ const VariablesProvider = ({ children }) => {
|
||||
);
|
||||
if (Array.isArray(current)) {
|
||||
const result = current.map((item) => {
|
||||
if (shouldToRequest(item[key]) && item.id != null) {
|
||||
if (shouldToRequest(item?.[key]) && item?.id != null) {
|
||||
if (associationField?.target) {
|
||||
const url = `/${collectionName}/${item.id}/${key}:${getAction(associationField.type)}`;
|
||||
if (hasRequested(url)) {
|
||||
@ -90,7 +90,7 @@ const VariablesProvider = ({ children }) => {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return item[key];
|
||||
return item?.[key];
|
||||
});
|
||||
current = _.flatten(await Promise.all(result));
|
||||
} else if (shouldToRequest(current[key]) && current.id != null && associationField?.target) {
|
||||
|
Loading…
Reference in New Issue
Block a user