Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#15996 closed defect (fixed)

Adding a progback causes returned promise to be resolved when progress is emitted

Reported by: Mark Wubben Owned by: Mark Wubben
Priority: blocker Milestone: 1.8.1
Component: Core Version: 1.8.0
Keywords: Cc: bforbes
Blocked By: Blocking:

Description

signalListener in dojo/Deferred unexpectedly resolves the promise's internal deferred when a progback function is available.

var dfd = new Deferred();
var p = dfd.then(null, null, function(){});
dfd.progress();
// p.isFulfilled() --> true

Given that I found this myself I suppose not many people are using progress updates…

Change History (7)

comment:1 Changed 7 years ago by Mark Wubben

Milestone: tbd1.8.1
Owner: set to Mark Wubben
Status: newassigned

comment:2 Changed 7 years ago by Mark Wubben

There's a patch at <https://github.com/novemberborn/dojo/commit/8f626cc419338c4bd0477039213453f09d987e4f>.

The patch comes with a small feature change: if the progback returns a value (that is not undefined), a new progress update is emitted on the returned promise. This makes it possible to propagate progress updates through a promise chain without having to explicitly break the change with other deferreds. Given that nobody else has found this bug before I think this is unlikely to break existing code.

comment:3 Changed 7 years ago by Kitson Kelly

Priority: undecidedblocker

comment:4 Changed 7 years ago by Mark Wubben

Cc: bforbes added

Bryan, would you be my review buddy on promise code? :-)

comment:5 Changed 7 years ago by Mark Wubben

Resolution: fixed
Status: assignedclosed

In [29702]:

Improve handling of progback results

  • Don't resolve the returned promise
  • If the progback returns a value, emit that value on the returned promise as a progress update, allowing for easier update propagation

Fixes #15996, !strict

comment:6 Changed 7 years ago by bill

Looks like you forgot to backport to 1.8 branch?

comment:7 Changed 7 years ago by Colin Snover

In [29736]:

Improve handling of progback results

  • Don't resolve the returned promise
  • If the progback returns a value, emit that value on the returned promise as a progress update, allowing for easier update propagation

Fixes #15996, !strict
Backport to 1.8.

Note: See TracTickets for help on using tickets.