Removal of ember-addons/ember-computed-decorators

AI-generated summary

The discussion centers on the migration of decorators from ember-addons/ember-computed-decorators to discourse-common/utils/decorators, which risks breaking plugins and themes upon update. angus raised concerns that the alias in discourse-loader.js isn’t fully resolving import issues, citing RequireJS errors. markvanlan clarified the alias should handle legacy imports, but acknowledged possible bugs with require usage. outofthebox shared a console warning screenshot, prompting markvanlan to confirm it’s a non-fatal warning for now. To identify affected plugins, markvanlan suggested searching plugin repos for the deprecated import. RGJ shared a helpful grep command that identified several plugins including discourse-canned-replies and discourse-local-dates. outofthebox later reported the issue resolved after plugin updates, citing a commit in discourse-data-explorer. merefield reassured the community that while warnings should be addressed promptly by plugin authors, they’re not critical — a continuous maintenance effort. The thread ends with appreciation for Discourse’s ongoing code improvements outofthebox.

@markvanlan The move of the decorators from ember-addons/ember-computed-decorators to discourse-common/utils/decorators is about to break a number of plugins and themes as soon as folks hit the big blue update button.

https://github.com/discourse/discourse/pull/8312

Would it be possible to leave the existing decorators in place (in addition to the new ones) to give us time to make the transition?

This should not be a breaking change. Here in the discourse-loader file, we have added an alias, so that anytime you try and import ember-addons/ember-computed-decorators, it will automatically load discourse-common/utils/decorator instead.

Yeah, I saw that. I’m not sure why, but that doesn’t seem to be working in all cases. I’m gettting a lot of requirejs errors that seem to resolve once I move to the new import.

Are you able to see if it is happening when using require instead of import?

That was a bug that I thought I had fixed.

Hi,

Here is the error message I hit on my Discourse site:

Screen Shot 2020-02-19 at 2.50.56 PM

Does this still need to be updated in the code base?

I can’t see exactly where that error is coming from (what plugin is using ember-addons/ember-compted-decorators), but it does eventually need to be fixed.

That is a warning, rather than an error because ember-addons/ember-compted-decorators is still functional for now.

Thanks @markvanlan,

What method do you use or recommend to identify a plugin that’s using deprecated assets?

I would see what plugins you have installed on your instance, then go to each repository in Github and search for ember-addons/ember-compted-decorators.

I believe some of our official Discourse plugins still need this updated so it could be one of our repos.

Can you expand that and see the full backtrace?

I don’t know how to see the backtrace behind a browser console warning?

I do know how to grep plugins though :smile:

$ grep -r ember-addons/ember-computed-decorators plugins/|grep import|awk -F / '{print $2}'|uniq|sort
discourse-canned-replies
discourse-local-dates
discourse-presence
discourse-push-notifications
discourse-saved-searches
procourse-memberships

Hi, I can’t currently reproduce it. But, the phenomenal @RGJ just updated the plugins on our site and I think this resolved the error? He pointed me to these updates:

DEV: Find/replace deprecated decorators · discourse/discourse-data-explorer@277346b · GitHub

Nice Grep Richard! :slight_smile:

I don’t think this is a lot to panic about.

It’s the responsibility of plugin makers to minimise these warnings ASAP too.

I’ve resolved quite a few recently and there will be more. It’s a never ending story :wink:

They are just warnings and nothing to really worry about unless they are ignored for too long.

Thanks. I love that Discourse continues to improve and maintain its code!