| 1223 | * in one entry. |
| 1224 | */ |
| 1225 | export function getWatchedKeys(id, newProps, graphs) { |
| 1226 | if (!(id && graphs && newProps.length)) { |
| 1227 | return []; |
| 1228 | } |
| 1229 | |
| 1230 | if (typeof id === 'string') { |
| 1231 | const inputs = graphs.inputMap[id]; |
| 1232 | return inputs ? newProps.filter(newProp => inputs[newProp]) : []; |
| 1233 | } |
| 1234 | |
| 1235 | const keys = Object.keys(id).sort(); |
| 1236 | const vals = props(keys, id); |
| 1237 | const keyStr = keys.join(','); |
| 1238 | const keyPatterns = graphs.inputPatterns[keyStr]; |
| 1239 | if (!keyPatterns) { |
| 1240 | return []; |
| 1241 | } |
| 1242 | return newProps.filter(prop => { |
| 1243 | const patterns = keyPatterns[prop]; |
| 1244 | return ( |
| 1245 | patterns && |
| 1246 | patterns.some(pattern => idMatch(keys, vals, pattern.values)) |
| 1247 | ); |
| 1248 | }); |
| 1249 | } |
| 1250 | |
| 1251 | /* |
| 1252 | * Return a list of all callbacks referencing a chunk of the layout, |