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

Feature/ember upgrade #153

Open
wants to merge 25 commits into
base: master
Choose a base branch
from
Open

Feature/ember upgrade #153

wants to merge 25 commits into from

Conversation

josex2r
Copy link
Contributor

@josex2r josex2r commented Nov 24, 2021

No description provided.

@codecov
Copy link

codecov bot commented Nov 24, 2021

Codecov Report

Merging #153 (45448aa) into master (7791d42) will not change coverage.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #153   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         7    +1     
  Lines           82       100   +18     
=========================================
+ Hits            82       100   +18     
Impacted Files Coverage Δ
addon/components/modal-container/index.js 100.00% <100.00%> (ø)
addon/components/modal-wrapper/index.js 100.00% <100.00%> (ø)
addon/components/modal/index.js 100.00% <100.00%> (ø)
addon/helpers/open-modal.js 100.00% <100.00%> (ø)
addon/models/modal.js 100.00% <100.00%> (ø)
addon/services/modal.js 100.00% <100.00%> (ø)
addon/utils/css-transitions/has-transitions.js 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 65b4bda...45448aa. Read the comment docs.


init() {
super.init(...arguments);
get componentName() {
Copy link
Contributor

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');
Copy link

Choose a reason for hiding this comment

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

async / await here?

this.trigger('open', model);

model.promise
.catch(() => {})
Copy link

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

xe21500
xe21500 previously approved these changes Dec 15, 2021
@@ -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}} />

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

Copy link

@SergeAstapov SergeAstapov Dec 21, 2021

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

Copy link
Contributor Author

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


@tracked _deferred;
@tracked _deferred = defer();

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);

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();

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?

Copy link
Contributor Author

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...
  }
}

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

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

@SergeAstapov
Copy link

@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
@SergeAstapov
Copy link

SergeAstapov commented May 23, 2022

@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

@adrigzr
Copy link
Contributor

adrigzr commented May 24, 2022

@etarancon, could you help @SergeAstapov with this? 😄

@SergeAstapov
Copy link

@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

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

Successfully merging this pull request may close these issues.

None yet

6 participants