Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#14820 closed defect (worksforme)

async: 'legacyAsync' on same-domain causes modules to doubly load

Reported by: Colin Snover Owned by: Rawld Gill
Priority: undecided Milestone: 1.7.3
Component: Loader Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description

Taking the code at http://staging.dojotoolkit.org/documentation/tutorials/1.6/hello_dojo/demo/, pointing to a same-domain built version of Dojo 1.7.2 and setting data-dojo-config="async: 'legacyAsync'" causes the dojo.require'd modules to be loaded once with script injection and then again with XHR.

Change History (4)

comment:1 Changed 7 years ago by Rawld Gill

Status: newassigned

I'm not sure of the precise config you are testing. I'm assuming you're using a document like this

<html>
<head>
	<meta charset="utf-8">
	<script data-dojo-config="async:'legacyAsync'" src="release/dojo/dojo/dojo.js"></script>
	<script>
		require(["dojo"], function(dojo){
		// New: Require in the dojo.fx module
		dojo.require("dojo.fx");

		// Remember, dojo.ready waits for both the DOM and all dependencies
		dojo.ready(function(){
			// The piece we had before - change our innerHTML
			dojo.byId("greeting").innerHTML += ", from " + dojo.version;

			// Now, slide the greeting
			dojo.fx.slideTo({
				top: 100,
				left: 200,
				node: dojo.byId("greeting")
			}).play();

		});
		});
	</script>

</head>
<body>
	<h1 id="greeting">Hello</h1>
</body>
</html>

Notice that this is different than the example in that the code is surrounded by

require(["dojo"], function(dojo){
// etc.
});

This is necessary because dojo is not automatically loaded when async is set to anything other than falsy. I think it is arguable that this should be changed.

In any event, this configuration loads correctly without double loads.

Please provide a the precise document that is causing the problem against a standard build.

Thanks!

comment:2 Changed 7 years ago by Rawld Gill

Resolution: worksforme
Status: assignedclosed

comment:3 Changed 7 years ago by Colin Snover

Hi Rawld,

The document that causes a problem is the one you were working with except without the extra wrapper. 1.6- loaded cross-domain loaded Dojo Base, so not sure why legacyAsync would/should not. Can you elaborate?

Thanks,

comment:4 Changed 7 years ago by Colin Snover

Rawld,

Could you please respond to my question from three weeks ago?

Thanks,

Note: See TracTickets for help on using tickets.