component's render() is not getting invoked after updating mobx store value

88 views Asked by At

Updating store before fetching data from server, works fine.. But after fetching data from from server and updating store, render() method not getting invoked code snippet

 @action
      static getPartner(partnerParams) {
         store.invitationDetails.invitingOrgPartnerName = ""; // here render() is getting invoked
        fetchPartner(partnerParams)
          .then((data) => data.json())
          .then(function (result) {
            if (result.success) {
              if (result.alreadyPartner) {
                  runInAction(() => {
                     store.invitationDetails.invitingOrgPartnerName = result.partnerName;   // here render() is NOT getting invoked      
                 }); 
              }
            }
          })
          .catch((e) => {
            console.info("Failed getting partners", e);
          });
      }
1

There are 1 answers

0
Ravi Suryawanshi On BEST ANSWER

One of the reason for your error

Mobx works perfectly in most of the cases but not always

You should use extendObservable Please follow this ExtendObservable