Select to view content in your preferred language

Delayed loading of some Calcite web components in Custom Widget (version 4.34)

183
0
3 weeks ago
GertConradie
Frequent Contributor

I use calcite-flow in a custom widget and want to upgrade from 4.30 to version 4.34

In the past I had to load some Calcite components (like calcite-flow) with "componentsUtils.loadCalciteComponents" to a path like:

"flow: () => new Promise((a, b) => require(['esri/chunks/calcite-flow'], a))" 

See my post here: 

https://community.esri.com/t5/calcite-design-system-questions/calcite-elements-in-custom-widget-but-...

From CoPilot:

"Some components (like calcite-button) are eagerly registered because they’re used in core widgets, while others (like calcite-flow) only get registered when a widget that depends on them (e.g. Popup) is instantiated."

I can confirm that if I open a popup on the map before using my Widget, everything works fine.

 

Recently the naming convention for the chunks is "indexed", while the index increment change between ArcGIS JavaScript Maps SDK version and i assume incremental releases as well.:

"flow: () => new Promise((a, b) => require(['esri/chunks/index19'], a)),"

(One can see this index naming by looking at the source code of the Popup)

 

How can I reliably load these Calcite components from a custom widget, or is one not supposed to use them in widgets?

CoPilot tell me to "rely on the API’s automatic lazy loader: simply declare <calcite-flow> or <calcite-flow-item> in your TSX render() method", but that is not working for me, and since "componentsUtils.loadCalciteComponents" is still used in the 4.34 Popup code, even ESRI still had to load them manually.

 

 

 

Tags (2)
0 Kudos
0 Replies