Skip to content

Feature/ember upgrade#153

Open
josex2r wants to merge 25 commits into
masterfrom
feature/ember-upgrade
Open

Feature/ember upgrade#153
josex2r wants to merge 25 commits into
masterfrom
feature/ember-upgrade

Conversation

@josex2r

@josex2r josex2r commented Nov 24, 2021

Copy link
Copy Markdown
Contributor

No description provided.

@codecov

codecov Bot commented Nov 24, 2021

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (7791d42) to head (45448aa).
⚠️ Report is 16 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #153   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            6         7    +1     
  Lines           82       100   +18     
=========================================
+ Hits            82       100   +18     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@josex2r
josex2r force-pushed the feature/ember-upgrade branch from 286ffa5 to 1673529 Compare December 1, 2021 10:56
Comment thread addon/models/modal.js Outdated

init() {
super.init(...arguments);
get componentName() {

Copy link
Copy Markdown
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
Copy Markdown

Choose a reason for hiding this comment

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

async / await here?

Comment thread addon/services/modal.js Outdated
this.trigger('open', model);

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

@SergeAstapov SergeAstapov Dec 21, 2021

Copy link
Copy Markdown

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
Copy Markdown
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

Comment thread addon/models/modal.js Outdated
@tracked isRejected = false;

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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

Copy link
Copy Markdown

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!

Comment thread .npmignore
/.nycrc.json
/.releaserc
/greenkeeper.json
/jsconfig.json

Copy link
Copy Markdown

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
Copy Markdown

@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

SergeAstapov commented May 23, 2022

Copy link
Copy Markdown

@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

adrigzr commented May 24, 2022

Copy link
Copy Markdown
Contributor

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

@SergeAstapov

Copy link
Copy Markdown

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

6 participants