Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Decorator is not applied properly #940

Closed
sywhang opened this issue Sep 22, 2022 · 0 comments · Fixed by #941
Closed

bug: Decorator is not applied properly #940

sywhang opened this issue Sep 22, 2022 · 0 comments · Fixed by #941
Assignees
Labels

Comments

@sywhang
Copy link
Contributor

sywhang commented Sep 22, 2022

Describe the bug
Decorator is not applied properly when it is not required through a "direct" dependency.

To Reproduce
See #939.

Expected behavior
The test added in #939

Internal Ref: GO-1668

@sywhang sywhang added the bug label Sep 22, 2022
@sywhang sywhang self-assigned this Sep 22, 2022
sywhang added a commit to sywhang/fx that referenced this issue Sep 22, 2022
There is a bug that only manifests when decorating objects in Fx
where transient dependency types are not properly decorated. For
example, if type A depends on type B, and type B depends on type C
which has a decorator, it fails to recognize that.

This only occurs when all constructors and the decorators for all
these types are provided at the "root" level fx.App.

This happens because fx injects a fake "root" Scope between the
actual root Container (which is where constructors are provided to
by default).

Fixed by making fx stop create this fake root Scope and use the
dig.Container directly.

Fixes uber-go#940.
sywhang added a commit that referenced this issue Sep 22, 2022
There is a bug that only manifests when decorating objects in Fx
where transient dependency types are not properly decorated. For
example, if type A depends on type B, and type B depends on type C
which has a decorator, it fails to recognize that.

This only occurs when all constructors and the decorators for all
these types are provided at the "root" level fx.App.

This happens because fx injects a fake "root" Scope between the
actual root Container (which is where constructors are provided to
by default).

Fixed by making fx stop create this fake root Scope and use the
dig.Container directly.

Fixes #940.
sywhang added a commit to sywhang/fx that referenced this issue Oct 11, 2022
There is a bug that only manifests when decorating objects in Fx
where transient dependency types are not properly decorated. For
example, if type A depends on type B, and type B depends on type C
which has a decorator, it fails to recognize that.

This only occurs when all constructors and the decorators for all
these types are provided at the "root" level fx.App.

This happens because fx injects a fake "root" Scope between the
actual root Container (which is where constructors are provided to
by default).

Fixed by making fx stop create this fake root Scope and use the
dig.Container directly.

Fixes uber-go#940.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

1 participant