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

@sort deprecation message missing replacement code #431

Open
jacobq opened this issue Apr 9, 2019 · 3 comments
Open

@sort deprecation message missing replacement code #431

jacobq opened this issue Apr 9, 2019 · 3 comments

Comments

@jacobq
Copy link

jacobq commented Apr 9, 2019

When I use a line like this in my Ember 3.9.0 app (w/ ember-decorators and ember-decorators-polyfill) I get a deprecation warning (expected) with apparently missing / incorrect instructions (unexpected).

import { mapBy, sort, uniq } from '@ember-decorators/object/computed';

image

@jacobq
Copy link
Author

jacobq commented Apr 9, 2019

This seems to be coming from

export const sort = legacyMacroWithMethod(emberSort);

export function legacyMacroWithMethod(fn, required) {

return computedDecoratorWithRequiredParams((elementDesc, params) => {
let method = getMethod(fn, elementDesc, params, required);
return fn(...params, method);
}, fn.name);

`You are using @${name} decorator from ember-decorators. This decorator is deprecated, you can now use Ember's built in decorators directly. Install the ember-decorators-polyfill (https://github.com/pzuraq/ember-decorators-polyfill), and replace your imports with imports from Ember:\n\n \`${importDesc};\`\n\n`,

since the calling function didn't provide importDesc.

A band-aid could be to check that importDesc is truthy before displaying it in the template string so that at least undefined; doesn't appear as the suggested replacement code. Better, perhaps legacyMacroWithMethod could be updated to pass the needed information through.

@jacobq
Copy link
Author

jacobq commented Apr 9, 2019

Is the suggested replacement code import { /* legacy macros here */ } from '@ember/object/computed';? The docs are either out of date or in disagreement with this as they show things like import { sort } from '@ember-decorators/object/computed';.
https://ember-decorators.github.io/ember-decorators/docs/api/modules/@ember-decorators/object/computed

@pzuraq
Copy link
Contributor

pzuraq commented Apr 9, 2019

Yup, basically all of these should be imported directly from Ember now. We’re working on the latest release, which will update the documentation and remove these methods.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants