-
Notifications
You must be signed in to change notification settings - Fork 4.6k
chore: converted isNewEntity lookup to use a set #38264
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1092,6 +1092,11 @@ export default class DataTreeEvaluator { | |
| const { isFirstTree, metaWidgets, unevalUpdates } = options; | ||
| let staleMetaIds: string[] = []; | ||
|
|
||
| const allNewEntityDiffSet = new Set( | ||
| unevalUpdates | ||
| .filter((v) => v.event === DataTreeDiffEvent.NEW) | ||
| .map((v) => v.payload.propertyPath), | ||
| ); | ||
|
Comment on lines
+1095
to
+1099
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential mismatch when storing entity property paths in a set. A possible fix is to store just the entity names in the set, for example: -const allNewEntityDiffSet = new Set(
- unevalUpdates
- .filter((v) => v.event === DataTreeDiffEvent.NEW)
- .map((v) => v.payload.propertyPath),
-);
+const allNewEntityDiffSet = new Set(
+ unevalUpdates
+ .filter((v) => v.event === DataTreeDiffEvent.NEW)
+ .map((v) => getEntityNameAndPropertyPath(v.payload.propertyPath).entityName),
+);
|
||
| let evalContextCache; | ||
|
|
||
| if (WorkerEnv.flags.release_evaluation_scope_cache) { | ||
|
|
@@ -1198,7 +1203,7 @@ export default class DataTreeEvaluator { | |
| if (isATriggerPath) continue; | ||
|
|
||
| const isNewWidget = | ||
| isFirstTree || isNewEntity(unevalUpdates, entityName); | ||
| isFirstTree || isNewEntity(allNewEntityDiffSet, entityName); | ||
|
|
||
| const widgetEntity = entity as WidgetEntity; | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Entity path vs. entity name mismatch.
This function only checks updates.has(entityName), but the set is populated with full property paths in index.ts unless corrected. Ensure that the stored values and this membership check are aligned.
If the goal is to confirm a new entity by name, consider storing only the entity name in the set or changing the membership check to parse out the entity name from the stored path.