Commit Graph

14 Commits (04f2375273a1aa6c3d3824af22aa68e784d27b5b)

Author SHA1 Message Date
David Baker 985966f8be Update async dialog interface to use promises
Hopefully makes the syntax a bit nicer. Also uses ES6 async import
rather than require.ensure which is now deprecated. Also also
displays an error if the component fails to load rather than falling
over in a heap, which is nice.
2018-11-21 16:56:44 +00:00
Richard van der Hoff 4d83150855 Transform `async` functions to bluebird promises
It turns out that the assertion made in
https://github.com/matrix-org/matrix-react-sdk/pull/1213 about `async`
functions returning bluebird promises was only correct when babel used an
inline version of the `asyncToGenerator` helper; in react-sdk we are using
`babel-transform-runtime` which means that we use a separate
`babel-runtime/helpers/asyncToGenerator`, which returns a native (or core-js)
Promise.

This meant that we were still in the situation where some methods returned
native Promises, and some bluebird ones, which is exactly the situation I
wanted to resolve by switching to bluebird in the first place: in short,
unless/until we get rid of all code which assumes Promises have a `done` method
etc, we need to make sure that everything returns a bluebird promise.

(Aside: there was debate over whether in the long term we should be trying to
wean ourselves off bluebird promises by assuming all promises are native. The
conclusion was that the complexity hit involved in doing so outweighed any
benefit of a potential future migration away from bluebird).
2017-07-13 17:10:08 +01:00
David Baker 2faf5702c9 Add plugin that makes babel 6 not break everything
Also transform-runtime here because we seem to need it here too
2016-10-17 16:24:19 +01:00
David Baker f9ef6ba871 Replace stage & es2017 with the specific plugins 2016-10-17 16:24:19 +01:00
David Baker 7436883704 Remove transform-runtime
We use instance methods (or at least, draft.js does) so we need
babel-polyfill instead.
2016-10-17 16:24:12 +01:00
David Baker eb9f884b53 Stage 0 is a little much 2016-10-17 16:23:26 +01:00
Aviral Dasgupta 022eb575d9 Upgrade to babel6 and enable some presets. 2016-10-17 16:23:25 +01:00
David Baker 5b4b81f7dc Revert "Switch to babel 6" 2016-10-14 18:49:52 +01:00
David Baker 8a0f6a0c6e Revert 09d2b2a36c
as babel 6 appears to break sending messages with the non RTE
editor
2016-10-14 18:48:41 +01:00
David Baker 09d2b2a36c Try adding transform-runtime in react-sdk
as it seems the runtime is undefined on the /develop, even though
it works just fine for me locally.
2016-10-14 18:32:52 +01:00
David Baker 4f261a0e96 Replace stage & es2017 with the specific plugins 2016-10-14 18:02:26 +01:00
David Baker 8b175880bb Remove transform-runtime
We use instance methods (or at least, draft.js does) so we need
babel-polyfill instead.
2016-10-13 10:55:58 +01:00
David Baker 5801bf60aa Stage 0 is a little much 2016-10-12 17:26:43 +01:00
Aviral Dasgupta 2d173d83b9 Upgrade to babel6 and enable some presets. 2016-10-02 17:27:45 +05:30