const validKeys = new Set(newVariables.map(v => v.name)); // Extracts valid keys from newVariables return Object.fromEntries(Object.entries(prev).filter(([key]) => validKeys.has(key))); // Removes invalid keys
const validKeys = new Set(newVariables.map(v => v.name)); // Extracts valid keys from newVariables return Object.fromEntries(Object.entries(prev).filter(([key]) => validKeys.has(key))); // Removes invalid keys