diff --git a/.changeset/shy-badgers-melt.md b/.changeset/shy-badgers-melt.md deleted file mode 100644 index 5273b1b1b..000000000 --- a/.changeset/shy-badgers-melt.md +++ /dev/null @@ -1,41 +0,0 @@ ---- -"ember-resources": patch ---- - -Fix situation where, when composing with blueprint/factory-creted Resources, the owner was not passed to the t`used`d resource. - -
Example from the added test - -```js -const Now = resourceFactory((ms = 1000) => - resource(({ on }) => { - let now = cell(nowDate); - let timer = setInterval(() => now.set(Date.now()), ms); - - on.cleanup(() => clearInterval(timer)); - - return () => now.current; - }) -); - -const Stopwatch = resourceFactory((ms = 500) => - resource(({ use }) => { - let time = use(Now(ms)); - - return () => format(time); - }) -); - -await render(); -``` - -The owner is part of the hooks API for `resource` and an error is thrown when it is undefined - regardless if used. - - -```js -const Demo = resource(({ on, use, owner }) => { - // ... -}); -``` - -
diff --git a/ember-resources/CHANGELOG.md b/ember-resources/CHANGELOG.md index 922d86973..a70a19d24 100644 --- a/ember-resources/CHANGELOG.md +++ b/ember-resources/CHANGELOG.md @@ -1,5 +1,46 @@ # ember-resources +## 6.1.1 + +### Patch Changes + +- [#925](https://github.com/NullVoxPopuli/ember-resources/pull/925) [`e320cf8`](https://github.com/NullVoxPopuli/ember-resources/commit/e320cf84b7ba82b6f9a2482bddb57e52732a6cab) Thanks [@NullVoxPopuli](https://github.com/NullVoxPopuli)! - Fix situation where, when composing with blueprint/factory-creted Resources, the owner was not passed to the t`used`d resource. + +
Example from the added test + + ```js + const Now = resourceFactory((ms = 1000) => + resource(({ on }) => { + let now = cell(nowDate); + let timer = setInterval(() => now.set(Date.now()), ms); + + on.cleanup(() => clearInterval(timer)); + + return () => now.current; + }) + ); + + const Stopwatch = resourceFactory((ms = 500) => + resource(({ use }) => { + let time = use(Now(ms)); + + return () => format(time); + }) + ); + + await render(); + ``` + + The owner is part of the hooks API for `resource` and an error is thrown when it is undefined - regardless if used. + + ```js + const Demo = resource(({ on, use, owner }) => { + // ... + }); + ``` + +
+ ## 6.1.0 ### Minor Changes diff --git a/ember-resources/package.json b/ember-resources/package.json index b0901c385..46e74a311 100644 --- a/ember-resources/package.json +++ b/ember-resources/package.json @@ -1,6 +1,6 @@ { "name": "ember-resources", - "version": "6.1.0", + "version": "6.1.1", "keywords": [ "ember-addon" ],