Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate the class-based Resource, moved to ember-modify-based-class-resource #1077

Merged
merged 1 commit into from
Jan 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions ember-resources/src/core/class-based/resource.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-ignore
import { getValue } from '@glimmer/tracking/primitives/cache';
import { setOwner } from '@ember/application';
import { deprecate } from '@ember/debug';
import { assert } from '@ember/debug';
// @ts-ignore
import { invokeHelper } from '@ember/helper';
Expand All @@ -16,6 +17,8 @@ import type { HelperLike } from '@glint/template';
// eslint-disable-next-line @typescript-eslint/consistent-type-imports
import type { Invoke } from '@glint/template/-private/integration';

let loggedDeprecation = false;

/**
* @private utility type
*
Expand Down Expand Up @@ -300,6 +303,27 @@ export class Resource<Args = unknown> {
// break existing code
constructor(owner: Owner | unknown) {
setOwner(this, owner as Owner);

if (!loggedDeprecation) {
deprecate(
`This implementation of class-based resources is deprecated.and will be removed in ember-resources@v7. ` +
`The exact same code and support is available at https://github.com/NullVoxPopuli/ember-modify-based-class-resource. ` +
`\`pnpm add ember-modify-based-class-resource\` and then \` import { Resource } from 'ember-modify-based-class-resource';\`. ` +
`See also: https://github.com/NullVoxPopuli/ember-resources/issues/1056`,
false,
{
id: `ember-resources.class-based`,
until: `7.0.0`,
for: `ember-resources`,
url: `https://github.com/NullVoxPopuli/ember-modify-based-class-resource`,
since: {
available: '6.4.4',
enabled: '6.4.4',
},
},
);
loggedDeprecation = true;
}
}

/**
Expand Down
Loading