Skip to content

Conversation

@3DataWill
Copy link
Contributor

@ngokevin what do you think of this approach?

Description: Prevents keys added to component data pooled objectss by dynamic schemas from appearing in other instances of the component. Only needs to be done on initialization because the object copy methods used in the update cycle already skip over keys with undefined values. Should have no effect for components without dynamic schemas.

Close #4012

Changes proposed:

  • utils.objectPool.removeUnusedKeys deletes properties not found in a reference object (i.e. the component template schema)
  • Apply above method when fetching initial objects during component initialization
@ngokevin
Copy link
Member

Thanks, I'll take a look later.


// Store component data from previous update call.
this.attrValue = undefined;
this.nextData = this.isObjectBased ? this.objectPool.use() : undefined;
Copy link
Member

@ngokevin ngokevin Feb 16, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps I'd just add a keysFilter argument to objectPool.use and pass the schema in versus a separate function.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@3DataWill What do you think about that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

2 participants