title: Recursive promise not resolving
body: <p>I have a function that fetches some data. If data is not available (it becomes available after some short time), it returns null. I created a function, that returns promise, which is wrapped around logic that fetches data and checks if it is is available - if not, it calls itself:</p>
  
  <pre><code>Foo.prototype.fetchDataWrapper = function () {
      return new Promise((resolve, reject) =&gt; {
          const data = fetchData();
          if (data) {
              resolve(data)
          } else {
              setTimeout(() =&gt; {
                  return this.fetchDataWrapper()
              }, 100)
          }
      })
  }
  </code></pre>
  
  <p>Problem is, that despite data is fetched correctly, this promise never resolves. What am I doing wrong?</p>