I was trying to test out the OmniscriptBaseMixin for my custom LWC that I created, but everytime I try to implement it, it does not work. This is the code: import { LightningElement } from 'lwc';
import { OmniscriptBaseMixin } from 'omnistudio/omniscriptBaseMixin';
export default class TestOmniMixin extends OmniscriptBaseMixin(LightningElement) {
connectedCallback() {
console.log('testOmniMixin omniJsonData:', this.omniJsonData);
}
} Essentially when I try to add it to my omniscript and I click on preview it just loads forever. And never starts the code. I am not sure what is wrong with it. Thank you to anyone that can help!
- OmniscriptBaseMixin only works inside an OmniScript runtime. If you access omniJsonData in connectedCallback, the preview hangs
- Use the LWC only inside an OmniScript
- Don’t use connectedCallback
- Access data in renderedCallback instead
- Make sure the OmniScript type is LWC and you’re previewing the OmniScript, not the LWC
import { LightningElement } from 'lwc';
import { OmniscriptBaseMixin } from 'omnistudio/omniscriptBaseMixin';
export default class TestOmniMixin extends OmniscriptBaseMixin(LightningElement) {
renderedCallback() {
console.log('omniJsonData:', this.omniJsonData);
}
}