Skip to content

fix(config): don't use an options array as a scope for its items - #12388

Open
b84330808 wants to merge 1 commit into
chartjs:masterfrom
b84330808:fix-options-array-item-keys
Open

b84330808 wants to merge 1 commit into
chartjs:masterfrom
b84330808:fix-options-array-item-keys

Conversation

@b84330808

Copy link
Copy Markdown

Fixes #11438

An object inside an options array also got the array itself as a scope, so it exposed the array's indexes and length as its own options. _resolveArray already filters the array out, but addScopes added it back through the key lookup. addScopes now skips arrays.

Running the flow from the issue, where a plugin hands its array option back and it gets passed in again, the option's JSON went from 83 to 491,483 bytes over 12 rounds, and each round from 2.6 to 233.1 ms. With the fix it stays at 23 bytes and about 2 ms.

An object in an options array also got the array itself as a scope, so it
exposed the array's indexes and length as its own options. A plugin that
reads such an option and passes it back in doubles the data every round.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Superfluous value copies inside plugin options

1 participant