fixes: component property value after a delay (#520)

This commit is contained in:
Arpit 2024-07-17 13:53:45 +05:30 committed by Kavin Venkatachalam
parent 8805af9ce1
commit 9637d561fb
2 changed files with 28 additions and 18 deletions

View file

@ -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 &&

View file

@ -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);