lundi 20 juillet 2020

Ember.js .refresh() not refreshing my page

I am working in an old ember app and the functionality of what I am working on is that a modal is open, tags are selected and the modal is closed. The close modal action uses send to an action in the photos controller that has a refresh action on it but my computed properties in that controller are not getting rerun. I need the quickSearchTagNames computed property to rerun in order to fetch the new tags to display on this page. From reading the Ember docs it was my understanding that calling refresh in the controller should refresh that page.

favorite tags route:

 close() {
        console.log("TRANSITION")
        this.send("sessionChanged");
      },     

photo route

sessionChanged: function() {
      console.log("Photo session change")
      this.transitionTo('franchisor.photos.index').then(() => {
        this.refresh();
      });
    }

computed property that is not reloading after refresh in the photos controller

quickSearchTagNames: Ember.computed('franchisor.id', function() {
      var franchisor = this.get('franchisor');
      var franchisorID = franchisor.get('id');
      const favoriteTagsPromise = this.get('favoriteTags').index({
        franchisorID
      });
console.log("IN quickSearchTagNames")
      const tagNamesPromise =
        favoriteTagsPromise.then(favoriteTags => favoriteTags.filter(tag => tag.get('favorite') === true).map(tag => tag.get('tagName')));
        console.log("tagNamesPromise", tagNamesPromise)
      return DS.PromiseArray.create({
        promise: tagNamesPromise
      });
    }),



Aucun commentaire:

Enregistrer un commentaire