diff --git a/mithril.js b/mithril.js index 5e8e7a44..44e57de1 100644 --- a/mithril.js +++ b/mithril.js @@ -743,7 +743,8 @@ var m = (function app(window, undefined) { var prop = m.prop(); promise.then(prop); prop.then = function(resolve, reject) { - return propify(promise.then(resolve, reject)) + promise = promise.then(resolve, reject).then(prop); + return prop; }; return prop } diff --git a/tests/mithril-tests.js b/tests/mithril-tests.js index a6c161ed..29416db3 100644 --- a/tests/mithril-tests.js +++ b/tests/mithril-tests.js @@ -1836,6 +1836,13 @@ function testMithril(mock) { xhr.onreadystatechange() return xhr.$headers["Content-Type"] === undefined }) + test(function() { + var prop = m.request({method: "POST", url: "test", initialValue: "foo"}).then(function(data) { return data; }) + var initialValue = prop(); + mock.XMLHttpRequest.$instances.pop().onreadystatechange() + + return initialValue === "foo" + }) test(function() { var prop = m.request({method: "POST", url: "test", initialValue: "foo"}) var initialValue = prop();