According to the documentation, it should be possible to use promises with popupTemplates:
const template = {
title: 'Title',
content: new Promise(function(res, rej) { res('test');}),
};
var featureLayer = new FeatureLayer({
url: url,
popupTemplate: template
});
However, with 4.7 this results in the following error:
Uncaught (in promise) TypeError: a.isFulfilled is not a function
at Object.get (MapView.js:143)
Solved! Go to Solution.
I've run into this problem as well after updating to 4.7. In prior versions of 4.x, native promises worked as expected for popup templates but at 4.7 they do not.
The solution is to NOT use native promises and instead use Dojo's version of promises: dojo/Deferred
The issue is that there is no .isFulfilled() method on native promises, however that method is is present on dojo/Deferred. I meant to file a bug report with Esri for this the other day when I found it but have not yet done so.
I've run into this problem as well after updating to 4.7. In prior versions of 4.x, native promises worked as expected for popup templates but at 4.7 they do not.
The solution is to NOT use native promises and instead use Dojo's version of promises: dojo/Deferred
The issue is that there is no .isFulfilled() method on native promises, however that method is is present on dojo/Deferred. I meant to file a bug report with Esri for this the other day when I found it but have not yet done so.
Cool, thanks for your answer