adopted-ember-addons / adopted-ember-addons/ember-metrics

Metrics adapters no longer inject services.

未关闭
#541 0 条评论 3 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
TypeScript
星标
367
派生
158
PR 合并指标
30 天内没有已合并 PR

描述

I have a few custom adapters in my application that depend on injected services.

I've updated my app to use ember-metrics 2.0.0-beta.2 and am now seeing this error in the console when running the app:

> Uncaught (in promise) Error: Assertion Failed: Attempting to lookup an injected property on an object without a container, ensure that the object was instantiated via a container.

Proposing this change to the metrics service to fix this:

```
/**
* Instantiates an adapter.
*
* @method _activateAdapter
* @param {Object}
* @private
* @return {Adapter}
*/
_activateAdapter({ adapterClass, config }) {
const adapter = new adapterClass(config);
setOwner(adapter, getOwner(this));
adapter.install();
return adapter;
}
```

贡献指南

打开贡献指南

调研方向

Start at the metrics service's _activateAdapter method shown in the issue and inspect how custom adapters are instantiated and activated. Verify the change against an application adapter that depends on injected services; done means the adapter can use those services without the reported container assertion.

由索引模型根据 Issue 内容生成。

评估

技术栈
typescript
领域
analytics
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。