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: Order annotation doesn't move dependent instances #454

Open
jamontes79 opened this issue May 2, 2024 · 2 comments
Open

bug: Order annotation doesn't move dependent instances #454

jamontes79 opened this issue May 2, 2024 · 2 comments

Comments

@jamontes79
Copy link
Contributor

If I have the following code

@singleton
@Order(-1)
class InitFeatureTogglesUseCase {
  InitFeatureTogglesUseCase(
    this._buildConfig,
    this._hiddenSettingsRepository,
    this._featureToggleRepository,
  );

The generated code is the following:

gh.singleton<_i3.InitFeatureTogglesUseCase>(_i3.InitFeatureTogglesUseCase(
      gh<_i4.BuildConfig>(),
      gh<_i5.HiddenSettingsRepository>(),
      gh<_i6.FeatureToggleRepository>(),
    )

But the instances of BuildConfig, HiddenSettingsRepository and FeatureToggleRepository are not instantiated because they have no order.

Any way of doing this without reordering manually all the instances?

Thanks in advance

@vicenterusso
Copy link

Same problem. Did you find any solution? My code is heavily based on this structure

@jamontes79
Copy link
Contributor Author

Same problem. Did you find any solution? My code is heavily based on this structure

I've made a workaround using scopes and grouped some specific classes.

It's not the best approach, but it work for us.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants