machty / ember-concurrency

ember-concurrency is an Ember Addon that enables you to write concise, worry-free, cancelable, restartable, asynchronous tasks.
http://ember-concurrency.com
MIT License
689 stars 157 forks source link

Not working in Ember 4.8+ #509

Open hoIIer opened 1 year ago

hoIIer commented 1 year ago

Just upgraded my app from ember 4.4 to ember 4.9 and the following code stopped working. It makes the api request successfully but never returns after that, hanging at the await line.

  fetchData = task({ restartable: true }, async () => {
    const { params } = this;

    if (params.q === '' || params.q === null) return;

    const res = await this.store.query('searchable', params);

I downgraded to ember 4.7 and it works again, having confirmed it doesn't work in 4.8 and 4.9

abel-n commented 1 year ago

Minimal reproduction in Ember and ED 4.9: https://github.com/abel-n/ec-237-ember-49

IgnaceMaes commented 1 year ago

Also running into this issue on ember-data@4.4.1 in combination with ember-concurrency@2.3.7. Awaiting a store promise in the task results in the following error:

vendor.js:163809 Uncaught TypeError: Cannot read properties of undefined (reading 'bind')
    at Object.get (vendor.js:163809:41)
    at TaskInstanceExecutor.handleYieldedValue (vendor.js:190078:36)
    at TaskInstanceExecutor.handleResolvedContinueValue (vendor.js:190005:12)
    at TaskInstanceExecutor.proceedSync (vendor.js:189957:14)
    at TaskInstanceExecutor.start (vendor.js:189897:12)
    at TaskInstance.start (vendor.js:189764:21)
    at vendor.js:188864:67
    at Array.forEach (<anonymous>)
    at Refresh.process (vendor.js:188864:30)
    at EmberScheduler.refresh (vendor.js:189000:36)

After upgrading to ember-data@4.7.3 the issue is resolved. (haven't tried later versions)

esbanarango commented 1 year ago

Looks like this issues is related to: https://github.com/emberjs/data/issues/8312#issuecomment-1370334665