-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feature/ember upgrade #153
base: master
Are you sure you want to change the base?
Conversation
BRAKING CHANGES: upgrade Ember version
Codecov Report
@@ Coverage Diff @@
## master #153 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 6 7 +1
Lines 82 100 +18
=========================================
+ Hits 82 100 +18
Continue to review full report at Codecov.
|
# Conflicts: # README.md # addon/components/modal.js # addon/services/modal.js
BRAKING CHANGE: modal component extends from Glimmer
286ffa5
to
1673529
Compare
BREAKING CHANGE: promise is fulfilled when the modal animation ends
addon/models/modal.js
Outdated
|
||
init() { | ||
super.init(...arguments); | ||
get componentName() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be inside modal-wrapper
and not in the model.
return () => { | ||
this.modal | ||
.open(modalName, options) | ||
.then(actions.onDone, actions.onFail, 'open-modal helper'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
async / await here?
addon/services/modal.js
Outdated
this.trigger('open', model); | ||
|
||
model.promise | ||
.catch(() => {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd try...catch here instead
@@ -0,0 +1,3 @@ | |||
<div role="dialog" data-id={{this.dataId}} data-modal-show={{this.dataModalShow}} {{did-insert this.onDidInsert}}> | |||
<@model.componentName @model={{@model}} @changeVisibility={{this.changeVisibility}} @element={{this.element}} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josex2r I may be wrong, but this should not work per emberjs/ember.js#17744
I assume, for embroider compatibility we should use ensure-safe-component
helper provided by @embroider/util
package like so
{{#let (ensure-safe-component (component @model.componentName)) as |Modal|}}
<Modal
@model={{@model}}
@changeVisibility={{this.changeVisibility}}
@element={{this.element}}
/>
{{/let}}
see docs https://github.com/embroider-build/embroider/tree/master/packages/util#the-utilities
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
my bad, didn't see it's actually being used in model.js
.
IMO it's better to do component/template manipulations in the hbs file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! I didn't read that the helper exists XD
addon/models/modal.js
Outdated
|
||
@tracked _deferred; | ||
@tracked _deferred = defer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_deferred
does not change during object lifecycle, maybe we don't need to use @tracked
here?
|
||
@action | ||
resolve(data) { | ||
this._fullfillmentFn = () => this.model.resolve(data); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor, this may be implemented using destroyable like so
registerDestructor(this, () => this.model.resolve(data));
not a big deal at all, but IMO it's easier to follow the code flow
|
||
@isNotDestroyed | ||
_safeDidOpen() { | ||
this.didOpen && this.didOpen(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this be this.args.didOpen
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this function is something like a component life-cycle hook, to notify when the modal is visible.
Was created to extend the modal class and prevent checking if a CSS transition exists and attaching to it using more callbacks:
// components/modal-foo.js
class ModalFoo extends ModalComponent {
didOpen() {
// Something to do here...
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@josex2r got it! Thanks for explanation!
/.nycrc.json | ||
/.releaserc | ||
/greenkeeper.json | ||
/jsconfig.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsconfig.json
probably should be kept as it should not be published to npm
@josex2r Thanks for working on this! |
# Conflicts: # addon/components/modal.js # addon/services/modal.js # package.json # tests/acceptance/modal-component-test.js # tests/dummy/app/components/modal-custom-modal/index.hbs # tests/dummy/app/styles/app.css # tests/integration/services/modal-test.js # yarn.lock
@josex2r @xe21500 @adrigzr is there something I can help to push this over the line and get released? I'm happy to help maintaining this addon. If that could help, I can help and split changes proposed in this PR into smaller PRs that are easier to review - if that can help expedite things. In addition to general Ember upgrades and transition to Glimmer component, this addon also great candidate for v2 format conversion |
@etarancon, could you help @SergeAstapov with this? 😄 |
@josex2r @etarancon @adrigzr would you like to add me as maintainer of the addon as I can get this, general addon upgrades/maintenance and v2 format conversion done |
No description provided.