adopted-ember-addons / ember-cli-flash

Simple, highly configurable flash messages for ember-cli
https://www.npmjs.com/package/ember-cli-flash
MIT License
355 stars 113 forks source link

Fix `getWithDefault` deprecation warning #326

Closed sandydoo closed 3 years ago

sandydoo commented 4 years ago

Starting with Ember v3.21, getWithDefault is deprecated and will be removed in v4.0.

https://emberjs.github.io/rfcs/0554-deprecate-getwithdefault.html

This PR adds the function as a utility, complete with tests.

I intentionally avoided the nullish operator ?? as it isn't available, based on the project's eslint config. I did, however, add an explicit check for null. Ember's default implementation does not do this, but it seems appropriate to add given the issues brought up in the RFC and provides a direct upgrade path to using ?? without get. I've checked all the usages of getWithDefault and believe this change shouldn't cause any unexpected issues.

chrismllr commented 3 years ago

Looks like an intermittent failure on the ember-release scenario, might just be able to re-run for it to succeed

dbendaou commented 3 years ago

Glad to see this merged :) Thanks! Could we release a new version having this PR in it ?

sbatson5 commented 3 years ago

I'm getting ready for a 2.0.0 release but I will cut a 1.9.1 to backfill this deprecation fix