Releases: NullVoxPopuli/ember-resources
v0.1.0-ember-resources-codemod: Merge pull request #1137 from NullVoxPopuli/release-preview
Release (2024-11-02)
ember-resources-codemod 0.1.0 (minor)
ember-resources 7.0.3 (patch)
🚀 Enhancement
ember-resources-codemod
,test-app
- #1147 Add v6 to v7 codemod (@NullVoxPopuli)
🐛 Bug Fix
📝 Documentation
🏠 Internal
ember-resources
,test-app-definitely-typed
,test-app
- #1158 Cleaning (@NullVoxPopuli)
Committers: 3
- Ozy Wu-Li (@ozywuli)
- @NullVoxPopuli
- @johanrd
v7.0.2-ember-resources: Merge pull request #1131 from NullVoxPopuli/release-preview
Release (2024-06-18)
ember-resources 7.0.2 (patch)
🐛 Bug Fix
ember-resources
,test-app
- #1135 Fix issue where, in some situations, the immediate-invoker helper manager (used when you use
resourceFactory
) was not correctly destroying the previous instance of a resource (such as when args change)) (@NullVoxPopuli)
- #1135 Fix issue where, in some situations, the immediate-invoker helper manager (used when you use
Committers: 1
v7.0.1-ember-resources: Merge pull request #1113 from NullVoxPopuli/release-preview
Release (2024-05-03)
ember-resources 7.0.1 (patch)
🐛 Bug Fix
ember-resources
,test-app
- #1129 Fix use types (@NullVoxPopuli)
📝 Documentation
- #1115 Update migrations for 7.0 (@NullVoxPopuli)
🏠 Internal
- #1130 Update release-plan (@NullVoxPopuli)
Committers: 1
v7.0.0: focus ember-resources, move utils to reactiveweb
Release (2024-01-11)
everything removed in this release is a utility, and the code + tests have been copied exactly to reactiveweb
: https://github.com/universal-ember/reactiveweb -- which is also a pay-as-you-go library.
ember-resources 7.0.0 (major)
💥 Breaking Change
ember-resources
,test-app
- #1101 Require an owner to exist to be wired through to the resource. (@NullVoxPopuli)
- #1087 Remove modifier (@NullVoxPopuli)
- #1085 Remove link (@NullVoxPopuli)
- #1082 Remove class-based Resource (@NullVoxPopuli)
test-app
- #1100 Require ember-cli-app-consumers have at least ember-cli-babel 8.2 (@NullVoxPopuli)
ember-resources
- #1090 Remove the 'core' import, only allowing importing from 'ember-resources' (@NullVoxPopuli)
@nullvoxpopuli/estimate-bytes
,docs
,ember-resources
,test-app
- #1083 Remove service (@NullVoxPopuli)
docs
,ember-resources
,test-app
- #1080 Drop all of the util imports (@NullVoxPopuli)
🚀 Enhancement
@nullvoxpopuli/estimate-bytes
,docs
,ember-resources
,test-app
- #1097 Infra modernization, support both built in types from ember-source, as well as the types from DefinitelyTyped (@NullVoxPopuli)
- Other
- #1099 Test against (and add support for) TypeScript 5.3 (@NullVoxPopuli)
ember-resources
- #1096 Drop unused dependencies and widen peers further (@NullVoxPopuli)
test-app
- #1095 Support ember-source 5.4 (@NullVoxPopuli)
- #1089 Ensure every supported version of Ember has no deprecations triggered from ember-resources' usage. (@NullVoxPopuli)
@nullvoxpopuli/estimate-bytes
,ember-resources
,test-app
- #1091 Implement custom usables,
regusterUsable
(@NullVoxPopuli)
- #1091 Implement custom usables,
🐛 Bug Fix
ember-resources
,test-app
- #1101 Require an owner to exist to be wired through to the resource. (@NullVoxPopuli)
📝 Documentation
docs
,ember-resources
- #1107 Move recommendation of resourceFactory to better align with how TypeScript works (@NullVoxPopuli)
- Other
- #1103 Remove class-based resource documentation (@NullVoxPopuli)
- #1102 Fix API Reference docs by moving from Cloudflare to Vercel (@NullVoxPopuli)
- #1079 Add link to the v6 branch (@NullVoxPopuli)
docs
- #1086 Remove API Reference docs' sidebar (@NullVoxPopuli)
@nullvoxpopuli/estimate-bytes
,docs
- #1084 Remove utils from API Reference docs (typedoc) (@NullVoxPopuli)
🏠 Internal
- Other
- #1106 Use fix for release-plan from: embroider-build/github-changelog#8 (@NullVoxPopuli)
- #1099 Test against (and add support for) TypeScript 5.3 (@NullVoxPopuli)
test-app
- #1104 Remove MSW (@NullVoxPopuli)
- #1088 Remove deprecation testing app that was added in v6 (@NullVoxPopuli)
ember-resources
- #1098 Remove unused type utils (@NullVoxPopuli)
Committers: 1
v6.5.1-ember-resources: Merge pull request #1093 from NullVoxPopuli/release-preview-v6
Release (2024-01-09)
ember-resources 6.5.1 (patch)
🐛 Bug Fix
ember-resources
- #1094 Fix declaration output (@NullVoxPopuli)
🏠 Internal
- #1092 Setup release automation for v6 (@NullVoxPopuli)
Committers: 1
v6.5.0-ember-resources: Merge pull request #1073 from NullVoxPopuli/release-preview
Release (2024-01-08)
ember-resources 6.5.0 (minor)
🚀 Enhancement
ember-resources
- #1076 Deprecate and move service and modifier to reactiveweb (@NullVoxPopuli)
- #1077 Deprecate the class-based Resource, moved to ember-modify-based-class-resource (@NullVoxPopuli)
- #1070 [v6]: Deprecate util/* imports (@NullVoxPopuli)
📝 Documentation
ember-resources
- #1078 Update deprecation links (@NullVoxPopuli)
🏠 Internal
test-app
- #1074 [v6]: Ensure that the available API for v7 does not throw deprecations (@NullVoxPopuli)
Committers: 1
v6.4.3-ember-resources: Merge pull request #1063 from NullVoxPopuli/release-preview
Release (2024-01-05)
ember-resources 6.4.3 (patch)
🐛 Bug Fix
ember-resources
,test-app
ember-resources
🏠 Internal
test-app
- #1069 Eslint plugin ember alpha v12 testing (@NullVoxPopuli)
- Other
- #1062 Setup release plan (@NullVoxPopuli)
Committers: 4
- Peter Wagenet (@wagenet)
- Yelin Zhang (@Yelinz)
- @NullVoxPopuli
- @johanrd
ember-resources@6.4.2
ember-resources@6.4.1
Patch Changes
-
#1011
606ba4b
Thanks @NullVoxPopuli! -trackedFunction
: Fix timing issue where updating tracked data consumed intrackedFunction
would not re-cause theisLoading
state to becometrue
again.Resolves #1010
ember-resources@6.4.0
Minor Changes
-
#975
1a964f1
Thanks @NullVoxPopuli! -trackedFunction
can now be composed just like regular resources.The function body still auto-tracks and will update within consuming resource appropriately.
Example
const Person = resourceFactory((maybeIdFn) => { return resource(({ use }) => { let request = use( trackedFunction(async () => { let id = typeof maybeIdFn === "function" ? maybeIdFn() : maybeIdFn; let response = await fetch(`https://api.github.com/users/${id}`); return response.json(); }) ); // `use` returns a ReadonlyCell where `.current` // is the State of trackedFunction. return () => request.current; }); });
Usage examples:
<template> {{#let (Person 1) as |request|}} {{#if request.isLoading}} ... loading ... {{/if}} {{#if request.value}} {{/if}} {{/let}} </template>
An async doubler
const Doubled = resourceFactory((num: number) => { return resource(({ use }) => { let doubler = use(trackedFunction(async () => num * 2)); // Since current is the "State" of `trackedFunction`, // accessing .value on it means that the overall value of // `Doubled` is the eventual return value of the `trackedFunction` return () => doubler.current.value; }); }); // Actual code from a test class State { @tracked num = 2; } let state = new State(); setOwner(state, this.owner); await render(<template><out>{{Doubled state.num}}</out></template>);
Example with arguments
Imagine you want to compute the hypotenuse of a triangle,
but all calculations are asynchronous (maybe the measurements exist on external APIs or something).// Actual code from a test type NumberThunk = () => number; const Sqrt = resourceFactory((numFn: NumberThunk) => trackedFunction(async () => { let num = numFn(); return Math.sqrt(num); }) ); const Squared = resourceFactory((numFn: NumberThunk) => trackedFunction(async () => { let num = numFn(); return Math.pow(num, 2); }) ); const Hypotenuse = resourceFactory((aFn: NumberThunk, bFn: NumberThunk) => { return resource(({ use }) => { const aSquared = use(Squared(aFn)); const bSquared = use(Squared(bFn)); const c = use( Sqrt(() => { return (aSquared.current.value ?? 0) + (bSquared.current.value ?? 0); }) ); // We use the function return because we want this property chain // to be what's lazily evaluated -- in this example, since // we want to return the hypotenuse, we don't (atm) // care about loading / error state, etc. // In real apps, you might care about loading state though! return () => c.current.value; // In situations where you care about forwarding other states, // you could do this return { get value() { return c.current.value; }, get isLoading() { return ( a.current.isLoading || b.current.isLoading || c.current.isLoading ); }, }; }); });