I'm getting the following error when using dojo/parser
in my code.
parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.
I've
define([
"dojo/_base/declare",
"dijit/_WidgetBase",
"myApp/base/_TemplatedMixin",
"dijit/_WidgetsInTemplateMixin",
"dojo/text!../templates/MyTemplate.html",
"dojo/i18n!../nls/Localized",
"myApp/js/utils/hint",
"dijit/form/ValidationTextBox",
"dijit/form/SimpleTextarea",
"dijit/form/Button",
"dojo/parser",
"dojo/domReady!"
], function (
declare,
_WidgetBase,
_TemplatedMixin,
_WidgetsInTemplateMixin,
template,
l10n,
hint
) {
'use strict';
/**
* @module
*/
return declare([_WidgetBase, _TemplatedMixin, _WidgetsInTemplateMixin], {
widgetsInTemplate: true,
/**
* @description Localized object for view
* @type {object}
*/
l10n: l10n,
/**
* @description Custom template for view
* @override
*/
templateString: template,
//postCreate: function () {
//hint(l10n.hint);
//}
});
});
I've done some research and realized it may have to do with dependencies and order. I've added the widgetsIntemplate
attribute but still no dice. This only happens on first load of the page.
Can anyone help?
The Dojo Parser is an optional module which is used to convert specially decorated nodes in the DOM and convert them into Dijits, Widgets or other Objects. By decoratedwe mean use of a data-dojo-typeattribute.
In case of an error, the promise becomes rejected, and the execution should jump to the closest rejection handler. But there is none. So the error gets “stuck”. There’s no code to handle it.
But if any of the promises above rejects (a network problem or invalid json or whatever), then it would catch it. The code of a promise executor and promise handlers has an "invisible try..catch " around it. If an exception happens, it gets caught and treated as a rejection.
Error handling with promises 1 Implicit try…catch. The code of a promise executor and promise handlers has an "invisible try..catch " around it. ... 2 Rethrowing. As we already noticed, .catch at the end of the chain is similar to try..catch. ... 3 Unhandled rejections. What happens when an error is not handled? ... 4 Summary. ...
If you have widgets in your template, you have to make sure they are all preloaded. Make sure your define has all the widgets in your template.
For future readers: This error message may also be thrown when creating one of the widgets in the template fails to any other reason.
For example I had a dijit/form/FilteringSelect
in a template and had a typo in the variable I passed to its store
property. So the store was undefined.
It can be quite hard to find the source of this error message sometimes.
buildRendering
function to see what is actually going wrong.If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With