tmcgee / cmv-widgets

Widgets for CMV, the Configurable Map Viewer.
https://cmv.io/
MIT License
38 stars 48 forks source link

Disclaimer box unreliably loading #10

Open wrightgd opened 9 years ago

wrightgd commented 9 years ago

I am trying to use the Disclaimer, but I'm finding it to unreliably load. I'd guess it's showing up maybe 30% of the time I load my map application. When it does not load, I see the following code in the console:

Uncaught Error: uniqName_5: parser returned unfilled promise (probably waiting for module auto-load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before instantiation.

One of the operational layers I'm loading is a large aerial image, and I was thinking the lag experienced loading that layer was causing the Disclaimer not to load. However, even when I do not bring in that aerial layer, the problem still persists.

Thoughts? Thanks!

tmcgee commented 9 years ago

Please check that you have the most recent version of the widget. There was a similar issue in the initial release that was addressed a month ago: https://github.com/tmcgee/cmv-widgets/commit/cbdc2f890bc6de04da81affbfb8c0cdd147b86aa

If you do have the latest, please check a couple of things:

  1. Have you modified the Disclaimer code in any way that might include additional widgets/modules?
  2. What other widgets do you have in your app? Any custom ones not provided with the cmv app code?
wrightgd commented 9 years ago

I just re-downloaded and re-added the widget to make sure I had the latest version--indeed I do.

  1. No, I have made no changes at all to the Disclaimer widget. Only modified the settings in viewer.js.
  2. The Disclaimer widget is the only custom one I have deployed. All others ones came off-the-shelf.

Let me confirm with you that I have integrated this correctly with the off-the-shelf CMV. My process was:

  1. Download your cmv-widgets repository as a zip and unzip.
  2. Move the widgets/Disclaimer/ folder and widgets/Disclaimer.js to my application folder under js/gis/dijit
  3. Copy/paste the Disclaimer settings from your readme file into my viewer.js file and change the path from path: 'widgets/Disclaimer' to path: 'gis/dijit/Disclaimer'.

Anything I've missed here?

tmcgee commented 9 years ago

It sounds like you have everything setup correctly. I have not been able to reproduce this behavior since the fix that was added a month ago.

mgd722 commented 9 years ago

I have this issue as well, though my disclaimer shows up probably about 80% of the time. The other 20% of the time I get the same error message listed above accompanied by the following:

dojo/parser::parse() error TypeError: Cannot read property 'toString' of undefined
    at http://js.arcgis.com/3.12compact/init.js:608:209
    at String.replace (native)
    at Object.f.substitute (http://js.arcgis.com/3.12compact/init.js:608:70)
    at q.postMixInProperties (http://js.arcgis.com/3.12compact/dijit/layout/ContentPane.js:5:34)
    at z.create (http://js.arcgis.com/3.12compact/dijit/_WidgetBase.js:5:195)
    at n (http://js.arcgis.com/3.12compact/init.js:106:103)
    at q.create (http://js.arcgis.com/3.12compact/dijit/layout/ContentPane.js:4:375)
    at z.postscript (http://js.arcgis.com/3.12compact/dijit/_WidgetBase.js:4:464)
    at new <anonymous> (http://js.arcgis.com/3.12compact/init.js:108:192)
    at q.markupFactory (http://js.arcgis.com/3.12compact/dijit/layout/ContentPane.js:3:478)

I find that the problem occurs most commonly when I do multiple successive page refreshes (about 5 seconds apart) in the same tab (Chrome 43). I haven't tried to reproduce it in any other browser.

chernandezCenipalmaOrg commented 9 years ago

I'm having the same issue. The behaviour is as reported by mgd722. In addition I also get the following error:

Uncaught TypeError: Cannot read property 'decimalFormat' of undefined

I followed the same installation procedure as the OP

tmcgee commented 9 years ago

@mgd722 Are you still experiencing this erratic behavior? The error message suggests to me that there is a timing issue loading the content of the disclaimer not the widget itself.

@chernandezCenipalmaOrg At first thought, I don't think your decimalFormat error would be related to the Disclaimer widget since we're not doing any number formatting in the widget. There was an error like this that had been identified in the MapInfo widget which was fixed a couple of versions ago. Perhaps that is what you are seeing.

chernandezCenipalmaOrg commented 9 years ago

@tmcgee I think the decimalFormat error is due to the scalebar widget malfunctioning when the Disclaimer problem happens, as I noticed it is not displaying the coordinates or the scale of the map and it only happens when the disclaimers fails.

tmcgee commented 9 years ago

@chernandezCenipalmaOrg thanks for the additional info. Like the MapInfo widget, the ESRI scalebar widget does numeric formatting so failing in a similar way is plausible.

I guess we need to look for a root cause. The disclaimer and the scalebar widgets could be failing due to the same root cause. I am not saying it isn't the disclaimer that is the cause. I just have not seen this myself and there's very little actual code in the widget.

Is this a possibility in your implementation: http://gis.stackexchange.com/questions/86674/arcgis-api-for-javascript-error-in-dojo-parser-parse which points to this thread: https://geonet.esri.com/thread/81475

mgd722 commented 9 years ago

@tmcgee I'm still having the issue, but it's very sporadic. None of my users have reported it and it really only seems to come up when I'm trying to debug something. Also, even when it fails to load, the rest of the app still works fine.

mgd722 commented 9 years ago

@tmcgee I just switched my content from a div with inline CSS (and a paragraph or two) to <h1>TEST</h1>. I haven't been able to reproduce the error like I used to. I think you're right; this is probably a timing issue when loading disclaimer html.

tmcgee commented 9 years ago

@mgd722 thanks for the feedback. I'm not sure how to address that within the disclaimer widget. Might be an issue with ContentPane used by the disclaimer widget?

tmcgee commented 9 years ago

If you have a lot of html content and are using the content attribute, you could try to put the html into a separate html file and use the href attribute to lazy load it.

mgd722 commented 9 years ago

@tmcgee Yeah, I was going to give that a try but then got pulled away for a bit. I'll load my original html that way some time this afternoon and report back.

chernandezCenipalmaOrg commented 9 years ago

I have the lang="es-ES" in my page. I'm going to test what happens removing it an I'll let you know.

mgd722 commented 9 years ago

I just tested lazy loading my html. I was still able to get the error to occur, but it was much less frequent (48 out of 50 refreshes, or 96%, went as expected). The two times it failed to load, I also got this error:

Uncaught Error: uniqName_4: parser returned unfilled promise (probably waiting for module auto-
load), unsupported by _WidgetsInTemplateMixin.   Must pre-load all supporting widgets before
 instantiation.

    f._beforeFillContent @ _WidgetsInTemplateMixin.js:3
    p.buildRendering @ _AttachMixin.js:2
    n @ init.js:106
    n.buildRendering @ _TemplatedMixin.js:4
    z.create @ _WidgetBase.js:5
    z.postscript @ _WidgetBase.js:4
    (anonymous function) @ init.js:108
    createWidget @ Controller.js:527
    g._hitchArgs @ init.js:176
    ha @ init.js:32
    (anonymous function) @ init.js:33
    ia @ init.js:33
    fa @ init.js:33
    g @ init.js:35
    (anonymous function) @ init.js:40

Honestly, it happens so infrequently now (and still only when I do multiple successive refreshes) that I don't really consider it worth much time.

tmcgee commented 9 years ago

@mgd722 That's the same error as in the OP which is a timing thing. I'll keep this issue open to track.

chernandezCenipalmaOrg commented 9 years ago

I tested removing the lang="es-ES" attribute from the html tag but the problem persists.

tmcgee commented 9 years ago

@chernandezCenipalmaOrg are you using the content attribute or the href attribute? From @mgd722 tests, it appears the html attribute maybe more reliable for loading the contents of the ContentPane.

chernandezCenipalmaOrg commented 9 years ago

@tmcgee I'm using the href attribute.

tmcgee commented 8 years ago

@chernandezCenipalmaOrg Have you tested to see if your issue is occurring in different browsers? If so, in which browsers have you experienced it? I am wondering if this is specific to one browser (like Internet Explorer 9). Thanks for any input you can provide.

chernandezCenipalmaOrg commented 8 years ago

@tmcgee I use Google Chrome 45.0.2454.93. I also tested with FireFox 40.0.3 and IE 10, and it works perfectly on them. The Issue seems specific to Chrome.

mgd722 commented 8 years ago

I'm on Chrome as well (version 45.0.2454.85 m). I haven't tested it thoroughly enough to comment on any other browsers.

sc-soln commented 8 years ago

This message only appears for me when using the compact build of the esri JS api, do others have the same behaviour?

tjones08 commented 8 years ago

I was having this issue with my custom widgets... been bugging me for months... i put in a small fix by setting a timeout after each widget instantiation which averted the problem 70% of the time. Changing from the compact version of 3.14 to the full version...fixed the problem. Pretty annoying, shouldn't be hard to compact your files correctly..

Kyte commented 7 years ago

I'm aware this is an old issue but it still happens. Both this and the decimalFormat error stem from the same issue: For some reason, ESRI's JS API and its included Dojo library sometimes fails to load the localization module, which makes the ContentPanes in the template fail during postMixinProperties as it tries to localize the "Loading..." notice. It's hard to repro because it doesn't always happen even within the same browser and build. Fortunately, switching away from compact fixes it.