NullVoxPopuli / ember-resources

An implementation of Resources. Supports ember 3.28+
https://github.com/NullVoxPopuli/ember-resources/blob/main/docs/docs/README.md
MIT License
91 stars 37 forks source link

Omit thunk in class-based resources when not needed #1008

Open gossi opened 11 months ago

gossi commented 11 months ago

When using a Resource but not using arguments with reactive parameters, then initializing them, so far still required the usage of a thunk, ie:

class TestResource extends Resource {
  foo = 3;
}

class Test {
  data = TestResource.from(this, () => []);
}

... for basically, no reason. This PR makes thunks a non-required parameter, leading into cleaner code like so:

class TestResource extends Resource {
  foo = 3;
}

class Test {
  data = TestResource.from(this);
}

:)

stackblitz[bot] commented 11 months ago

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

changeset-bot[bot] commented 11 months ago

🦋 Changeset detected

Latest commit: d656eb42903417a8dd60f2c461385e20704c7569

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package | Name | Type | | --------------- | ----- | | ember-resources | Minor |

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR