Add `SwitchFeature`, rebrand `FeatureToggled` and performance improvements
·
2091 commits
to main
since this release
馃挘 Breaking changes
FeatureToggled
andrender
(func) is now only invoked when feature matcheschildren
on the other-hand is invoked withisFeatureEnabled
in any case- This matches behaviour in
react-router
- This matches behaviour in
- Anywhere you used
variate
you should now usevariation
- We used the wrong terms here sorry for the confusion
馃毈 Deprecations
FeatureToggled
got renamed toToggleFeature
FeatureToggled
will be supported for some time but using it will give you awarning
馃専 Features
SwitchFeature
is new component rendering the first matchingToggleFeature
- It hope to ease so called multi variate testing by ensuring that only one feature is rendered at a time
<SwitchFeature>
<ToggleFeature flag="foo" variation="bar" toggledComponent={MyFeature}/>
<ToggleFeature flag="foo" variation="baz" render={() => <p>Turned on</p>} />
<ToggleFeature flag="foo" variation="bar">
{ ({ isFeautureEnabled } ) => <p>Turned on?: { isFeatureEnabled }</p> }
</ToggleFeature>
<ToggleFeature flag="foo" variation="foo" toggledComponent={MyFeature} untoggledComponent={DisabledFeature}/>
</SwitchFeature>
馃 Fixes
ConfigureFlopflip
is now more mindful about not triggering wasteful renders- All of its unrelated state is extracted away from React to speed up your app
ConfigureFlopflip
and the underlyingFlagSubscription
had a hairy infinite configuration loop- The needed mix of
componentDidMount
andcomponentDidUpdate
in pair withconfigure
andreconfigure
lead to a repeated brute force configuration of adapters which yielded a stack overlow - While fixing the bug we improved our internal state handling from naive boolean flags to more descriptive enums
- The needed mix of
- Wrapping of
displayNames
is now removed for all components- This makes snapshotting more consistent between releases
- It eases testing with enzyme (a
wrapper.find('ToggleFeature
is enough)
馃挊 Tooling
- Dependencies have been updated again making sure
flopflip
is compatible with React@16.2