cmv/cmv-wab-widgets

WAB widgets do not load on mobile devices

bsnider opened this issue · 6 comments

  1. Load the demo in Chrome
  2. Open Dev Tools
  3. Click the 'Toggle device toolbar' icon and select a tablet or phone, such as the iPhone 7.
  4. Refresh
  5. The page never loads, with the following error:

init.js:28 Uncaught TypeError: this.widgetManager.loadWidget is not a function
at Object. (BaseWidgetPanel.js:76)
at Object.forEach (init.js:70)
at Object.loadAllWidgetsInOrder (BaseWidgetPanel.js:66)
at Object.startup (BaseWidgetPanel.js:55)
at Object.placeAt (init.js:361)
at Object.createWidget (_WidgetsMixin.js:190)
at Object. (_WidgetsMixin.js:171)
at init.js:63
at ia (init.js:28)
at init.js:28

I believe this is due to the panel being collapsed when the page loads, preventing the widget to properly initialize.

@bsnider Thanks for reporting this. I can confirm seeing the same thing in Chrome and using my phone. I just submitted a [PR](cmv/cmv-app#730 for CMV] that I believe would help address with this issue.

@bsnider I've tested this locally with the code in the PR and it doesn't appear to fix this issue. Something else is going on. Investigating...

This doesn't appear to be related to the pane open or closed. widgetManager is undefined because the code is failing silently on this method call to get the appConfig from WAB. This indicates 2 things: 1) more error handling is needed to report the error and 2) dive deeper into WAB to identify what it apparently does so different with mobile that is causing this call to fail.

@bsnider

The problem is lang.clone(this.appConfig) is failing in the getAppConfig method of WAB's ConfigManager but only when WAB detects it is running in mobile.

Current solution appear to be to change the references to cm.getAppConfig() on line 80 and line 86 to simply be cm.appConfig. There may be some residual effects from this but none detected so far...

@tmcgee Thank you very much for looking into this!

fixed in b1d25b3