Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

Fix afterFetchCallback Promise Condition #42

Merged

Conversation

juan-gunawan
Copy link
Contributor

Somehow, async-await-to-promises mangled the previous condition to the one below, which is completely wrong.

if (!(_this5.state.isLoading === false)) {
          return Promise.resolve().then(function () {
            return cache.resolve(query);
          }).then(function () {
            return new Promise(function (resolve) {
              return _this2.props.afterFetchCallback(resolve, cache.getContents());
            });
          }).then(function () {
            if (typeof _this5.props.afterFetchCallback === "function") ;

            _this5.setState({
              isLoading: false
            });
          })
}

Instead, had to move the afterFetchCallback checking into the Promise.

@juan-gunawan juan-gunawan merged commit e3f6c50 into traveloka-archive:master Jul 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant