Hi,
I'm creating a PowerApps model driven app using DataVerse.
I created a Blank App based on Dataverse, and then a custom page.
I imported my custom PCF React component that uses React.
This component uses a Bryntum React Gantt chart that I imported using npm. I want to add DataVerse data to it.
So far, I have got the context.webAPI to fetch data from a custom DataVerse table and I can render the Bryntum Gantt.
The problem is that the Bryntum Gantt React component is rendered when I am editing the custom page, but not in the published app.
In the published app I get the following error:
Cannot read properties of undefined (reading 'cssVersion')
Error code: 0x0
or Details: TypeError: Cannot read properties of undefined (reading 'cssVersion')
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:13829:250)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:29576:272)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:32307:119)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:32571:109)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:33062:103)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:39049:37)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:39066:215)
at Gantt.construct (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:53711:1436)
at new _Base (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:1899:93)
at new Localizable (webpack://pcf_tools_652ac3f36e1e4bca82eb3c1dc44e6fad/./node_modules/@bryntum/gantt/gantt.module.js?:3269:341)
The error source in gantt.module.js:
//region Init & destroy
construct() {
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
var me = this
, {domSyncCallback} = me
, {recomposeAsync} = _Widget;
if (recomposeAsync != null && me.recomposeAsync == null) {
me.recomposeAsync = recomposeAsync;
}
if (!globalThis.bryntum.cssVersion) {
var cssVersion = globalThis.bryntum.cssVersion = CSSHelper.getCSSVersion()
, jsVersion = VersionHelper.getVersion("core");
if (cssVersion && cssVersion !== jsVersion) {
console.warn("CSS version ".concat(cssVersion, " doesn't match bundle version ").concat(jsVersion, "!\nMake sure you have imported css from the appropriate product version."));
}
}
I can kind of fix the error by changing the globalThis object before the component is rendered:
// Manually initialize the cssVersion if not present
console.log('globalThis: ', globalThis);
// @TS-ignore
if (!globalThis.bryntum) {
console.log('!globalThis.bryntum');
// @TS-ignore
globalThis.bryntum = {};
}
// @TS-ignore
if (!globalThis.bryntum.cssVersion) {
console.log('!globalThis.bryntum.cssVersion');
// @TS-ignore
globalThis.bryntum.cssVersion = '5.6.9'; // Ensure this matches the version of Bryntum Gantt you are using
}
I then have issues with the Bryntum Gantt component props being passed into the component.
What causes the difference in rendering in the published app?