Giter VIP home page Giter VIP logo

Comments (4)

ijlee2 avatar ijlee2 commented on May 30, 2024 1

I replied to @Windvis' question on Discord.

from ember-intl.

Windvis avatar Windvis commented on May 30, 2024

We're also running into this. We use ember-intl in an addon and allow apps to set the prefered language, if they don't want the default (which is en-us). But after the 6.1+ update apps are forced to set the language (or simply access the service in some way) because of this error, even if they want the default. We could work around this by injecting and accessing the service somewhere in the addon code before the render happens, but that's obviously not ideal.

Some quick debugging points me to this line:

const initialLocale = this.locale || ['en-us'];

If the this.locale access is removed the error disappears. I think we can safely remove that, since it can never not be something else than null at this point in the constructor AFAIK?

from ember-intl.

Windvis avatar Windvis commented on May 30, 2024

Looking further, it seems to be caused by the @dependentKeyCompat decorator:

@dependentKeyCompat

After accessing this._locale directly or removing dependentKeyCompat from the getter the error isn't triggered either.

(I still think we can simply remove the this.locale access at that point, since it will always be null. I'm just trying to figure out why the error is thrown, since accessing tracked state in the constructor during a render that uses that state should be fine, AFAIK).

from ember-intl.

ijlee2 avatar ijlee2 commented on May 30, 2024

I think we can ignore the originally reported issue, because this.intl.setLocale(['en-us']) hadn't been called in the app's application route.

I tried out @Windvis's approach of removing @dependentKeyCompat in #1843. I think this can help us fix the issue of You attempted to update _locale, where rendering and unit tests without setupIntl() would error starting [email protected].

I suspect that @dependentKeyCompat had been added to support macros (to be removed in [email protected]), so we can't merge #1843 at the moment.

from ember-intl.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.