# 商店中水合查找结果时可能存在 Bug

**URL:** <https://meta.discourse.org/t/potential-bug-in-store-when-hydrating-find-results/92394>\
**Category:** Development\
**Created:** [2018 年7 月 15 日 14:57 UTC](https://meta.discourse.org/t/potential-bug-in-store-when-hydrating-find-results/92394 "2018-07-15T14:57:20Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![kleinfreund](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@kleinfreund](https://meta.discourse.org/u/kleinfreund)\
发布日期： [2018 年7 月 15 日 14:57 UTC](https://meta.discourse.org/t/potential-bug-in-store-when-hydrating-find-results/92394/1 "2018-07-15T14:57:21Z")

</div>

What is the following line doing: [discourse/app/assets/javascripts/discourse/models/store.js.es6  
 ](https://github.com/discourse/discourse/blob/master/app/assets/javascripts/discourse/models/store.js.es6#L98)?

```js
return this._hydrate(type, result[Ember.String.underscore(type)], result);

```

In particular, why is the second argument of the `_hydrate()` method not the `result` object? Usually, the second argument for this method is the record object that is saved to/retrieved from the store.

Here, when I’m trying to find a record by ID, I will always run into this line:

```js
if (!obj) {
  throw new Error("Can't hydrate " + type + " of `null`");
}

```

That’s because `_hydrate()` will be called with `result[Ember.String.underscore(type)]`. Since my record doesn’t have a property named like the `type`, that’s always `undefined`.

Is that a bug?

---

_[View the full topic](https://meta.discourse.org/t/potential-bug-in-store-when-hydrating-find-results/92394)._
