mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 08:58:26 +00:00
fixes: component property value after a delay (#520)
This commit is contained in:
parent
8805af9ce1
commit
9637d561fb
2 changed files with 28 additions and 18 deletions
|
|
@ -33,6 +33,8 @@ export const shouldUpdate = (prevProps, nextProps) => {
|
|||
deepEqualityCheckusingLoDash(prevProps?.id, nextProps?.id) &&
|
||||
deepEqualityCheckusingLoDash(prevProps?.component?.definition, nextProps?.component?.definition) &&
|
||||
deepEqualityCheckusingLoDash(prevProps?.customResolvables, nextProps?.customResolvables) &&
|
||||
deepEqualityCheckusingLoDash(prevProps?.properties, nextProps?.properties) &&
|
||||
deepEqualityCheckusingLoDash(prevProps?.styles, nextProps?.styles) &&
|
||||
prevProps?.width === nextProps?.width &&
|
||||
prevProps?.height === nextProps?.height &&
|
||||
prevProps?.darkMode === nextProps?.darkMode &&
|
||||
|
|
|
|||
|
|
@ -449,29 +449,37 @@ function containsBracketNotation(queryString) {
|
|||
}
|
||||
|
||||
export function findAllEntityReferences(node, allRefs) {
|
||||
const extractReferencesFromString = (str) => {
|
||||
const regex = /{{(components|queries)\.[^{}]*}}/g;
|
||||
const matches = str.match(regex);
|
||||
if (matches) {
|
||||
matches.forEach((match) => {
|
||||
const ref = match.replace('{{', '').replace('}}', '');
|
||||
const entityName = ref.split('.')[1];
|
||||
allRefs.push(entityName);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (typeof node === 'object') {
|
||||
for (let key in node) {
|
||||
const value = node[key];
|
||||
if (typeof value === 'string' && containsBracketNotation(value)) {
|
||||
//skip if the value is a bracket notation
|
||||
|
||||
break;
|
||||
}
|
||||
if (typeof value === 'string') {
|
||||
if (containsBracketNotation(value)) {
|
||||
// Skip if the value is a bracket notation
|
||||
break;
|
||||
}
|
||||
|
||||
if (
|
||||
typeof value === 'string' &&
|
||||
value.includes('{{') &&
|
||||
value.includes('}}') &&
|
||||
(value.startsWith('{{components') || value.startsWith('{{queries'))
|
||||
) {
|
||||
const referenceExists = value;
|
||||
|
||||
if (referenceExists) {
|
||||
const ref = value.replace('{{', '').replace('}}', '');
|
||||
|
||||
const entityName = ref.split('.')[1];
|
||||
|
||||
allRefs.push(entityName);
|
||||
if (
|
||||
value.includes('{{') &&
|
||||
value.includes('}}') &&
|
||||
(value.startsWith('{{components') || value.startsWith('{{queries'))
|
||||
) {
|
||||
extractReferencesFromString(value);
|
||||
} else {
|
||||
// Handle cases where references are embedded within strings
|
||||
extractReferencesFromString(value);
|
||||
}
|
||||
} else if (typeof value === 'object') {
|
||||
findAllEntityReferences(value, allRefs);
|
||||
|
|
|
|||
Loading…
Reference in a new issue