Opened 10 years ago
Closed 10 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 )
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)
Change History (28)
comment:1 Changed 10 years ago by
Owner: | changed from Douglas Hays to bill |
---|---|
Status: | new → assigned |
comment:2 follow-up: 3 Changed 10 years ago by
Description: | modified (diff) |
---|---|
Owner: | changed from bill to Mike Palmer |
Status: | assigned → pending |
@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 follow-up: 4 Changed 10 years ago by
Status: | pending → new |
---|
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 10 years ago by
Attachment: | state-response.txt added |
---|
from call using 1.6.1 the response from dojo.data.ItemFileReadStore?({ url: "/theProject/app/codes/STATE" }),
comment:4 Changed 10 years ago by
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 10 years ago by
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
comment:6 Changed 10 years ago by
Status: | new → pending |
---|
@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 10 years ago by
Status: | pending → new |
---|
<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 10 years ago by
Status: | new → pending |
---|
@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 10 years ago by
@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 10 years ago by
Status: | pending → new |
---|
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
comment:11 Changed 10 years ago by
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 10 years ago by
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:14 Changed 10 years ago by
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 10 years ago by
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 10 years ago by
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 10 years ago by
Status: | new → pending |
---|
Maybe _setStoreAttr() isn't getting called, to convert your legacy store into the new dojo/store API. Please check that.
comment:18 Changed 10 years ago by
Resolution: | → invalid |
---|---|
Status: | pending → closed |
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 10 years ago by
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 10 years ago by
Attachment: | StateFilteringSelect.js added |
---|
FilteringSelect? with store defined in declaration instead of as a param
comment:20 Changed 10 years ago by
Milestone: | tbd → 1.8 |
---|---|
Priority: | undecided → blocker |
Resolution: | invalid |
Status: | closed → reopened |
Summary: | extending FilteringSelect not working in 1.7.2 → Regression 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.
comment:21 Changed 10 years ago by
Owner: | changed from Mike Palmer to bill |
---|---|
Status: | reopened → assigned |
Changed 10 years ago by
Attachment: | 15004.patch added |
---|
Fix infinite loop by preventing dojo.data stores from receiving back-compat code.
comment:22 Changed 10 years ago by
comment:23 Changed 10 years ago by
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 10 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
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!
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?