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

Get rid of ember-classic-decorator dependency #789

Merged

Conversation

andreyfel
Copy link

ember-classic-decorator was supposed to be used during the transition period while converting from classic classes to native.

It is time to get rid of it as it creates issues like this: emberjs/ember-classic-decorator#99 emberjs/ember-classic-decorator#74 etc.

The transition is easy, just replace this.set with set(this, ...

Andrey Fel added 2 commits January 24, 2023 17:36
ember-classic-decorator was supposed to be used during the transition
period while converting from classic classes to native.

It is time to get rid of it as it creates issues like this:
emberjs/ember-classic-decorator#99
emberjs/ember-classic-decorator#74
etc.

The transition is easy, just replace this.set with set(this, ...
It seems to be something super legacy.
Removing it also fixes embroider scenarios.
@andreyfel
Copy link
Author

@elwayman02 please take a look

@elwayman02
Copy link
Owner

Thanks for bringing up this PR! It'll be great to get another legacy dependency out of the way. I left a few small comments that should be easy to address, and I think we'll be good after that. :)

@andreyfel
Copy link
Author

@elwayman02 I've addressed most of your comments and made a few other modernizations, please take a look again.

Copy link
Owner

@elwayman02 elwayman02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look great, but there appears to be a small issue with the demo app where the userActive event got duplicated for all columns instead of a list of different events:

Ember_User_Activity

You can see the expected behavior here: https://ember-user-activity.jhawk.co/

@@ -25,13 +25,6 @@ module.exports = {
env: {
browser: true,
},
rules: {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, I love this!

let owner = getOwner(this);
return owner.lookup('service:fastboot');
get _isFastBoot() {
return typeof FastBoot !== 'undefined';
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice improvement :)

set(this, 'EVENT_THROTTLE', 0);
}
// Do not throttle in testing mode
this.EVENT_THROTTLE = Ember.testing ? 0 : 100;
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice adaption

Andrey Fel added 5 commits January 27, 2023 09:56
ember-data was not used
ember-decorators is no longer used
I saw this technique in ember-data repo as a modern trick to detect if we
are in a FastBoot env.
user-activity and user-idle services suppose that inheriting services
override `defaultEvents` and `activeEvents` through default property
values which is not possible if we change init to constructor.

We will need a breaking change in API in order to migrate to
constructors in these services. Leave TODOs there for now.
@andreyfel andreyfel force-pushed the get-rid-of-ember-classic-decorator branch from 2b15cdd to c66811f Compare January 27, 2023 08:56
@andreyfel
Copy link
Author

@elwayman02 oops, I messed up the glimmer component conversion, now it is fixed.

Copy link
Owner

@elwayman02 elwayman02 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great! Thanks for the hard work and incorporating my review feedback.

@elwayman02 elwayman02 merged commit 77446d0 into elwayman02:master Jan 31, 2023
@elwayman02
Copy link
Owner

Bonus celebration: These changes made the embroider-safe build finally pass! Nicely done.

@andreyfel andreyfel deleted the get-rid-of-ember-classic-decorator branch January 31, 2023 08:26
@andreyfel
Copy link
Author

@elwayman02 thanks for merging! Will you be able to cut a release with these changes?

@elwayman02 elwayman02 added internal dependencies Pull requests that update a dependency file labels Jan 31, 2023
@elwayman02
Copy link
Owner

Changes have been released!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file internal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants