lundi 24 octobre 2016

Ember: QueryParams are loading slowly

I am currently having an issue where my queryParams are loading slowly, and my properties are being computed before the queryParams have been set.

I have a controller that looks something like this:

queryParams: { travelAgentUserToken: "ta-token" },

travelAgentUserToken: "",

session: function () {

    console.log("---- session", this.get("travelAgentUserToken"));

    return DS.PromiseObject.create({
        promise: this.store.queryRecord("session", {token: this.get("userToken") || this.get("travelAgentUserToken")})
    });

}.property("travelAgentUserToken"),

When my page is loaded with the code above, my console.log will be triggered the first time with a value (corresponding to the travelAgentUserToken query param) of "", then the actual value will be loaded momentarily after.

In my mind this should not be happening, and the queryParams should be loaded before anything is computed. Has anyone else had this issue?




Aucun commentaire:

Enregistrer un commentaire