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
Describe the bug
Using the untoggledComponent prop of the ToggleFeature component with MemoryAdapter appears to cause an infinite re-render loop resulting in an OOM Error in a vitest unit test.
We are using MemoryAdapter with a set of defaultFlags to provide "mock flags" to the unit tests, through a "mock" ConfigureFlopFilp provider.
To Reproduce
Steps to reproduce the behavior:
Given a ConfigureFlopFilp provider using MemoryAdapter and a set of defaultFlags,
Then when using the untoggledComponent prop of the ToggleFeature component such that we return a component from the toggledComponent prop, and return () => null from the untoggledComponent prop,
That causes an infinite re-render loop during a run of unit tests with vitest, and eventually exits with an OOM Error.
While using the same ToggleFeature in normal execution outside of test operates as expected.
Expected behavior
We should be able to use the same ToggleFeature with an untoggledComponent and a null/empty toggledComponent in the normal application and in a mocked unit test with the same result, and no infinite re-render/OOM.
Screenshots
Additional context
Replacing the ToggleFeature using untoggledComponent and a null/empty toggledComponent, with the use of the useFeatureToggle(flagName) hook and a conditional render of the untoggled component ovoids this OOM error. So it appears that there's some difference of behavior between the hook and the ToggleFeature component.
The text was updated successfully, but these errors were encountered:
Thanks for reporting this issue in great detail. I'll try to make room to investigate it. If you find out more and can even propose a fix please don't hesitate to do so.
Describe the bug
Using the
untoggledComponent
prop of theToggleFeature
component withMemoryAdapter
appears to cause an infinite re-render loop resulting in an OOM Error in a vitest unit test.We are using
MemoryAdapter
with a set ofdefaultFlags
to provide "mock flags" to the unit tests, through a "mock"ConfigureFlopFilp
provider.To Reproduce
Steps to reproduce the behavior:
ConfigureFlopFilp
provider usingMemoryAdapter
and a set ofdefaultFlags
,untoggledComponent
prop of theToggleFeature
component such that we return a component from thetoggledComponent
prop, and return() => null
from theuntoggledComponent
prop,ToggleFeature
in normal execution outside of test operates as expected.Expected behavior
We should be able to use the same
ToggleFeature
with anuntoggledComponent
and a null/emptytoggledComponent
in the normal application and in a mocked unit test with the same result, and no infinite re-render/OOM.Screenshots
Additional context
Replacing the
ToggleFeature
usinguntoggledComponent
and a null/emptytoggledComponent
, with the use of theuseFeatureToggle(flagName)
hook and a conditional render of the untoggled component ovoids this OOM error. So it appears that there's some difference of behavior between the hook and theToggleFeature
component.The text was updated successfully, but these errors were encountered: