Closed r0one closed 3 years ago
(Edited) FYI, this pull request fixes the issue for me. For anyone needing this PR, you can install using yarn add stefanpenner/ember-moment#351/head
while waiting for a new release
Oh, nice.
@R0one I'm not a maintainer on this package, so I haven't merged your PR, I'm just suggesting how to install it while the maintainers create a new release. I think you should keep this PR open
Well, I haven't dug Ember's documentation, but according to folks from the other PR, importing bool
seemed more idiomatic?
Btw I haven't ran any tests... The other PR seemed to have been taken much more seriously haha
But you're right, I'll keep it open and in WIP status so that it gets the maintainers' attention, they'll decide what to do with it.
I did some digging into Ember's computed
, and it seems like computed.bool
still works. So something is going wrong here by the time ember-moment
is running.
(result is the same with the old syntax, too)
❯ npm list ember-source | unme
my-app@0.0.0 /✂️/my-app
└── ember-source@3.27.5
So, I think I'm in favor of merging this and getting a release out as this is a blocker to any app using ember-moment upgrading to 3.27+.
Though, I would like to know what has happened to Ember.computed
in ember-moment.
Further observations about the difference between direct computed.bool usage vs ember-moment: In the same app, I reproduce via:
ember install ember-moment
add
{{moment-format (now) 'YYYY'}}
which looks like:
So it looks like ember-moment is being transpiled with the ember-global, rather than retaining the computed
import. :thinking:
I think that is because ember-moment is on a very old version of ember-cli-babel.
@R0one if you want to rebase, that'd be great -- I setup GitHub Actions, so we have CI now -- we can make sure this doesn't break anything
👀
Wouldn't this pull request be considered a breaking change? Since the code is no longer converting whatever value is set into a Boolean. Wouldn't the solution be to do the same thing that computer.bool does and wrap "Boolean()" around the fetched value.
I think the next release we do of ember-moment is going to be a breaking change anyway, because we can't test against 3.13+ atm
If anyone is blocked to upgrade ember-source
from this. You can use this patch:
patches/ember-moment+8.0.1.patch
diff --git a/node_modules/ember-moment/addon/helpers/-base.js b/node_modules/ember-moment/addon/helpers/-base.js
index b3fbb05..e93671a 100644
--- a/node_modules/ember-moment/addon/helpers/-base.js
+++ b/node_modules/ember-moment/addon/helpers/-base.js
@@ -6,7 +6,8 @@ import { inject as service } from '@ember/service';
export default Helper.extend({
moment: service(),
disableInterval: false,
- globalAllowEmpty: computed.bool('moment.__config__.allowEmpty'),
+ globalAllowEmpty: computed('moment.__config__.allowEmpty', function()
+ {return this.get('moment.__config__.allowEmpty'); }),
supportsGlobalAllowEmpty: true,
localeOrTimeZoneChanged: observer('moment.locale', 'moment.timeZone', function() {
this.recompute();
thanks for the stop-gap @esbanarango -- I think since it's been 8 days since asking for a rebase, I'm going to take this over. I'll post back here when released (if CI for existing support matrix is green)
Fix released in 8.0.2
When using the moment-format helper on an ember app transpiled for the latest 2 versions of Chrome and Firefox (tested on Firefox 90.0.2), I get the following error:
Uncaught (in promise) TypeError: Ember.computed.bool is not a function
(stack trace below).This seems to be caused by this transpiled code:
The source code is very similar, I believe that
computed.bool
has been deprecated and thatcomputed
is now a decorator.