You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are using Atomizer in a Webpack plugin with multiple entry points feeding in a common config object for breakpoints and custom definitions. The common config object passed as second argument to Atomizer.getConfig() is injected with a classes property which seems to grow with additional classes each time it is called leading to later calls including all classes from previous calls.
My workaround will be to explicitly create a new object for each call however I don't believe the input object should be mutated in this case.
Expectation
getConfig should be a pure function (based on it's name and implied usage)
Reproduction
Call getConfig twice with different sources but the same config definition (second argument) and see the second will include all references from the first file processed.
Fix
Return a new object and add a unit test to ensure the arguments are the same before and after the function is called.
Problem
We are using Atomizer in a Webpack plugin with multiple entry points feeding in a common config object for breakpoints and custom definitions. The common config object passed as second argument to
Atomizer.getConfig()
is injected with a classes property which seems to grow with additional classes each time it is called leading to later calls including all classes from previous calls.My workaround will be to explicitly create a new object for each call however I don't believe the input object should be mutated in this case.
Expectation
getConfig
should be a pure function (based on it's name and implied usage)Reproduction
Call getConfig twice with different sources but the same config definition (second argument) and see the second will include all references from the first file processed.
Fix
Return a new object and add a unit test to ensure the arguments are the same before and after the function is called.
atomizer/src/atomizer.js
Lines 125 to 130 in 0f0fbf4
The text was updated successfully, but these errors were encountered: