This builds upon earlier work in #399 which allowed source and strategy factories to conditionally return null or undefined to signal that they should be ignored by the coordinator factory. The issue with this approach is that the returned value still ends up in the application's container, and non-objects are not handled properly when the container is destroyed. This could cause issues in test teardown for instance.
Instead of returning a custom value from create, it is now recommended that the default export of the source or strategy module be conditionally changed to a non-factory (e.g. null or undefined) to signal that it should be ignored. This avoids the call to lookup and thus prevents nullish values from entering the container. Documentation and an example have been added to the README.
This builds upon earlier work in #399 which allowed source and strategy factories to conditionally return
null
orundefined
to signal that they should be ignored by the coordinator factory. The issue with this approach is that the returned value still ends up in the application's container, and non-objects are not handled properly when the container is destroyed. This could cause issues in test teardown for instance.Instead of returning a custom value from
create
, it is now recommended that the default export of the source or strategy module be conditionally changed to a non-factory (e.g.null
orundefined
) to signal that it should be ignored. This avoids the call tolookup
and thus prevents nullish values from entering the container. Documentation and an example have been added to the README.