Opened 8 years ago

Closed 7 years ago

#15004 closed defect (fixed)

[regression] ComboBox: hang in subclass specifying dojo.data (old API) store in prototype

Reported by: Mike Palmer Owned by: bill
Priority: blocker Milestone: 1.8
Component: Dijit - Form Version: 1.7.2
Keywords: Cc:
Blocked By: Blocking:

Description (last modified by bill)

Have a custom FiltingSelect and it's been working fine for version 1.6.x just fine. Then tried upgrading to one of the 1.7.x versions, and all versions fail to populate the drop down and warnings and errors are displayed.

The .js file:

define(["dijit/form/FilteringSelect", 
        "dojo/data/ItemFileReadStore"
        ], function(){

	dojo.declare("theProject.widget.StateFilteringSelect", [dijit.form.FilteringSelect], {
		placeHolder: "Select a State",
		searchAttr: "name",
		label: "State:",
		name: "state",
		style: "width: 160px",
		store: new dojo.data.ItemFileReadStore({ url:  "/theProject/app/codes/STATE" }),
		value: '',

	}); // declare
}); // define

The firebug console:

GET http://localhost:9083/theProject/js/dojo-release-1.7.2-src/dojo/data/ObjectStore.js
DEPRECATED: e1412.widget.StateFilteringSelect.store.fetch() is deprecated for builtin store. Use store.query() -- will be removed in version: 2.0

(Deprecated warning repeats over 100 times) then script either stops with no items in the drop down, or browser locks up.

Attachments (4)

state-response.txt (4.7 KB) - added by Mike Palmer 8 years ago.
from call using 1.6.1 the response from dojo.data.ItemFileReadStore?({ url: "/theProject/app/codes/STATE" }),
filteringselect.html (1.1 KB) - added by haysmark 7 years ago.
HTML
StateFilteringSelect.js (740 bytes) - added by haysmark 7 years ago.
FilteringSelect? with store defined in declaration instead of as a param
15004.patch (987 bytes) - added by haysmark 7 years ago.
Fix infinite loop by preventing dojo.data stores from receiving back-compat code.

Download all attachments as: .zip

Change History (28)

comment:1 Changed 8 years ago by Douglas Hays

Owner: changed from Douglas Hays to bill
Status: newassigned

bill, maybe issuing the deprecated message over and over is a bit overkill and is starving the browser's UI thread.
mwpalmer, can you comment out the deprecated messages in dijit/form/ComboBoxMixin.js to see if the problem goes away?

comment:2 Changed 8 years ago by bill

Description: modified (diff)
Owner: changed from bill to Mike Palmer
Status: assignedpending

@mwpalmer, let us know if commenting out that deprecated message fixes it and if not, please attach the full test case (hopefully a single HTML file, but you can attach the data in a separate file if you need to) so that I can reproduce the problem.

comment:3 in reply to:  2 ; Changed 8 years ago by Mike Palmer

Status: pendingnew

Replying to bill:

@mwpalmer, let us know if commenting out that deprecated message fixes it and if not, please attach the full test case (hopefully a single HTML file, but you can attach the data in a separate file if you need to) so that I can reproduce the problem.

Commented out following line in ComboBoxMixin?.js :

kernel.deprecated(clazz + ".store.fetch() is deprecated for builtin store.", "Use store.query()", "2.0");

Still having problems. Now when I try to open the FilteringSelect? there is just 1 line in firebug: GET.../dojo-release-1.7.2/dojo/data/ObjectStore.js

It sits on that line for a minute, then it crashes Firefox.

Changed 8 years ago by Mike Palmer

Attachment: state-response.txt added

from call using 1.6.1 the response from dojo.data.ItemFileReadStore?({ url: "/theProject/app/codes/STATE" }),

comment:4 in reply to:  3 Changed 8 years ago by Mike Palmer

Replying to mwpalmer:

Replying to bill:

@mwpalmer, let us know if commenting out that deprecated message fixes it and if not, please attach the full test case (hopefully a single HTML file, but you can attach the data in a separate file if you need to) so that I can reproduce the problem.

Commented out following line in ComboBoxMixin?.js :

kernel.deprecated(clazz + ".store.fetch() is deprecated for builtin store.", "Use store.query()", "2.0");

Still having problems. Now when I try to open the FilteringSelect? there is just 1 line in firebug: GET.../dojo-release-1.7.2/dojo/data/ObjectStore.js

It sits on that line for a minute, then it crashes Firefox.

A few more details. I've attached the response to the URL call (from 1.6.1, when it works). Also, if I switch to a hard coded solution using a dojo.store.Memory I was able to run in 1.7.2. However, I need a non-hard coded solution. So is how dojo.data.ItemFileReadStore? is handled changed between 1.6.x to 1.7.x? Hope that helps. Thanks!

comment:5 Changed 8 years ago by Mike Palmer

To make the issue simpler to look at, I switched from "url" to "data" so I hope it will be easier to analyze. Same issue either way with it showing "GET.../dojo-release-1.7.2/dojo/data/ObjectStore.js " and crashing browser. Once again, code works in 1.6.x, but not 1.7.x.

Here's the code that I hope speeds resolution of problem. Please let me know what else I can do to get this resolved quickly. Thanks!

define(["dijit/form/FilteringSelect", 
        "dojo/data/ItemFileReadStore"
        ], function(){

	dojo.declare("theProject.widget.StateFilteringSelect", [dijit.form.FilteringSelect], {
		placeHolder: "Select a State",
		searchAttr: "name",
		label: "State:",
		name: "state",
		style: "width: 160px",
//		store: new dojo.data.ItemFileReadStore({ url:  "/theProject/app/codes/STATE" }),
		store: new dojo.data.ItemFileReadStore({ data: 
			{items:[
				{name:"Florida", id:"FL"},
				{name:"Colorado", id:"CO"},
				{name:"Michigan", id:"MI"},
				{name:"Minnesota", id:"MN"},
				{name:"Wisconsin", id:"WI"},
			]}
		}),
		
		value: ''
		
	}); // declare
}); // define
Last edited 8 years ago by bill (previous) (diff)

comment:6 Changed 8 years ago by bill

Status: newpending

@mwpalmer - as I mentioned above, I need you to attach an HTML file (rather than a code snippet) to reproduce the problem, thanks.

comment:7 Changed 8 years ago by Mike Palmer

Status: pendingnew

<html> <body class="soria">

<script type="text/javascript">

dojo.require("theProject.widget.StateFilteringSelect?");

</script>

<input data-dojo-type="theProject.widget.StateFilteringSelect?">

</body> </html>

comment:8 Changed 8 years ago by bill

Status: newpending

@mwpalmer - Use the ATTACH FILE button to attach an HTML file that's a working test case, so I can type the URL for that file into the browser and see the error.

comment:9 Changed 8 years ago by dylan

@mwplamer: The provided example mixes non-AMD and AMD style syntax. I think it would be better to fully convert to AMD to reduce the complexity of your example. The attachment is a partial example that you'll need to finish, it should get you started.

<html>
<head>
dojoConfig = {
	packages: [{
	    name: "theProject",
	    location: "/theProject"
	},
	async:1,
	parseOnLoad: true
	]
}
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.7.2/dojo/dojo.js" 
	data-dojo-config="async:1, parseOnLoad: true"></script>
<script type="text/javascript">
require(["theProject/widget/StateFilteringSelect"]);

</script>
</head>
<body class="soria">
<input data-dojo-type="theProject/widget/StateFilteringSelect">

</script>

</body> </html>

and then in a js file at theProject/widget/StateFilteringSelect.js you would have:

define(["dojo/_base/declare", "dijit/form/FilteringSelect", "dojo/data/ItemFileReadStore", "dojo/domReady!"],
    function(declare, FilteringSelect, ReadStore){
        return declare([FilteringSelect, ReadStore, "dojo/domReady!"], {
			placeHolder: "Select a State",
			searchAttr: "name",
			label: "State:",
			name: "state",
			style: "width: 160px",
	//		store: new ReadStore({ url:  "/theProject/app/codes/STATE" }),
			store: new ReadStore({ data: 
				{items:[
					{name:"Florida", id:"FL"},
					{name:"Colorado", id:"CO"},
					{name:"Michigan", id:"MI"},
					{name:"Minnesota", id:"MN"},
					{name:"Wisconsin", id:"WI"},
				]}
			}),
		
			value: ''
		
		}); // declare
	}); // define

comment:10 Changed 8 years ago by Mike Palmer

Status: pendingnew

Hi,

Tried the sample code provided. Have not been able to create a stand alone html file that executes the code. Are there any other samples to work from to create the needed html file? I would like to get code that works in this way, not only for this issue, but for any future issue.

As far as testing, the error occurs when one clicks the down arrow on the StateFilteringSelect?. So if you can simply include it in a working html file, I think you'll see the error.

Looking forward to getting this resolved. Getting a stand along example to work and getting around this issue would be great progress!

Have a good day!

Mike

Last edited 8 years ago by Mike Palmer (previous) (diff)

comment:11 Changed 8 years ago by bill

We have lots of stand-alone files to test dojo. dijit/tests/form/_autoCompleter.html is one for ComboBox/FilteringSelect although it's much longer than you would want.

You shouldn't need anything with packages or multiple files for your test case, except perhaps having two files, the main HTML file and then a data file.

comment:12 Changed 8 years ago by Mike Palmer

Hi,

I've been able to run the built in tests just fine. It's integrating the extended FilteringSelect? that's still the challenge. Are there any examples that show a FilteringSelect? being extended and run in the stand alone test format?

Thanks!

Mike

comment:13 Changed 8 years ago by bill

Sorry, I don't think there are any examples like that. (AFAIK)

comment:14 Changed 8 years ago by Mike Palmer

Hi,

Still not able to get example working in format requested. Are you able to extend a FilteringSelect? in a 1.7.x environment? Is it possible run with code give to this point? I'm stuck and I'd like to find a way to continue to make progress on this issue. Thanks!

Mike

comment:15 Changed 8 years ago by Mike Palmer

Greetings!

Continuing work on this issue. Haven't been able to run in exact format described. Looking for any working examples of extending a FilteringSelect?, and so far no luck. Could really use some help.

This roadblock is getting close to the point that causes all developers to shudder. Could get the "let's not upgrade anymore and stick with old version going forward..." direction soon from above. Please, don't let this happen.

Thanks again for all you help. Hope we can resolve soon!

Mike

comment:16 Changed 8 years ago by Mike Palmer

Hi,

Anyone else out there seeing this issue? Anyone able to extend a FilteringSelect?? Problem still exists and is preventing an upgrade. If you have examples, either working or non-working, please post them to help speed resolution of this ticket.

Thanks!

Mike

comment:17 Changed 8 years ago by bill

Status: newpending

Maybe _setStoreAttr() isn't getting called, to convert your legacy store into the new dojo/store API. Please check that.

comment:18 Changed 8 years ago by trac-o-bot

Resolution: invalid
Status: pendingclosed

Because we get so many tickets, we often need to return them to the initial reporter for more information. If that person does not reply within 14 days, the ticket will automatically be closed, and that has happened in this case. If you still are interested in pursuing this issue, feel free to add a comment with the requested information and we will be happy to reopen the ticket if it is still valid. Thanks!

comment:19 Changed 8 years ago by Mike Palmer

Hi,

Still not able to extend a FilteringSelect? in 1.7.x. Was able to do so in 1.6.x. Would like to see a working example of any extending of the FilteringSelect?. At this point we reworked our application so that we are not trying to extend any FilteringSelects?. This is not an optimal solution, but project deadlines require we move forward. If the FilteringSelect? is fixed to allow for extending, we would be happy to use it once again.

Thanks!

Mike

Changed 7 years ago by haysmark

Attachment: filteringselect.html added

HTML

Changed 7 years ago by haysmark

Attachment: StateFilteringSelect.js added

FilteringSelect? with store defined in declaration instead of as a param

comment:20 Changed 7 years ago by haysmark

Milestone: tbd1.8
Priority: undecidedblocker
Resolution: invalid
Status: closedreopened
Summary: extending FilteringSelect not working in 1.7.2Regression in [25531]: ComboBoxMixin goes into infinite loop

Starting in [25531], custom ComboBoxMixins that have their store defined on the widget declaration, instead of in the constructor params, go into an infinite loop when you click the arrow.

I've attached two files demonstrating the issue.

The loop is in the fetch and query logic:

  • Clicking the arrow button starts a _SearchMixin._startQuery
  • _startQuery calls the ComboBoxMixin's mixed in query
  • The mixed in query calls the mixed in fetch
  • The mixed in fetch calls ObjectStore.fetch
  • ObjectStore.fetch calls the underlying objectStore.query (which we set to ComboBoxMixin.store; the mixed in query is called again)

There seems to be an assumption in ComboBoxMixin that if the user did not provide a store in the constructor, then they are using option tags.

Last edited 7 years ago by haysmark (previous) (diff)

comment:21 Changed 7 years ago by haysmark

Owner: changed from Mike Palmer to bill
Status: reopenedassigned

Changed 7 years ago by haysmark

Attachment: 15004.patch added

Fix infinite loop by preventing dojo.data stores from receiving back-compat code.

comment:22 Changed 7 years ago by haysmark

I attached a potential fix. [25502] was being applied to old stores, when it should only be applied to a new store backed by option tags. [25531] just excaberated the issue. My fix uses [25531] to prevent [25502] from being applied to old stores. Option tags still pass through correctly.

comment:23 Changed 7 years ago by bill

Description: modified (diff)
Summary: Regression in [25531]: ComboBoxMixin goes into infinite loop[regression] ComboBox: hang in subclass specifying dojo.data (old API) store in prototype

OK, thanks for tracking that down, and for the patch, it looks good. I'll run the tests and add a test for this ticket.

comment:24 Changed 7 years ago by bill

Resolution: fixed
Status: assignedclosed

In [28963]:

Fix subclasses of ComboBox/FilteringSelect that specify an old dojo.data store as part of the prototype, rather than as a parameter to the constructor. Thanks Mark for the fix!

Note: See TracTickets for help on using tickets.