The problem apparently was that the content of event.detail
was an object.
To solve it, instead of dispatching the event with { detail: data }
I dispatched it with { detail: JSON.stringify(data) }
. Then this can be parsed in the listener and the promise resolves correctly resolve(JSON.parse(event.detail))
.
1 Like