3

Updated the question:

We are using custom Lightning Console App. Here is a simplified version of our LWC to explain the problem. Any idea?

sampleWireContextEventWarning.html

    <template>
        <lightning-button variant="brand" label="Brand action" title="Brand action" 
            onclick={handleClick} class="slds-m-left_x-small"
        ></lightning-button>
    </template>

sampleWireContextEventWarning.js

import { LightningElement } from 'lwc';
import { NavigationMixin } from 'lightning/navigation';

export default class SampleWireContextEventWarning extends NavigationMixin(LightningElement) {
    handleClick(event){
        this[NavigationMixin.Navigate]({
            type: 'standard__recordPage',
            attributes: {
                recordId: "500r0000004QblbAAC",
                objectApiName: "Case",
                actionName: "view"
            },
        });
    }
}

When I include this component to a page in App Builder and click on the button, I could see the navigation to the Case Record happening, but I could still see the warning in the browser console.

[LWC warning]: Invalid event type "WireContextEvent" dispatched in element . Event name should only contain lowercase alphanumeric characters. aura_proddebug.js:242 at SampleWireContextEventWarning.dispatchEvent (https://static.lightning.force.com/cs32/auraFW/javascript/NlYMGsCv2IRRXpX5txmc5Q/aura_proddebug.js:7245:28) aura_proddebug.js:242 at SampleWireContextEventWarning.wrappedMethod [as dispatchEvent] (https://static.lightning.force.com/cs32/auraFW/javascript/NlYMGsCv2IRRXpX5txmc5Q/aura_proddebug.js:19687:31) aura_proddebug.js:242 at t.get (https://micps--cpsuat.lightning.force.com/components/laf/contextService.js:2:1896) aura_proddebug.js:242 at m (https://micps--cpsuat.lightning.force.com/components/laf/contextService.js:2:1204) aura_proddebug.js:242 at n (https://micps--cpsuat.lightning.force.com/components/laf/contextService.js:2:1389) aura_proddebug.js:242 at Object.a.getContextValues (https://micps--cpsuat.lightning.force.com/components/laf/contextService.js:2:3199) aura_proddebug.js:242 at d (https://micps--cpsuat.lightning.force.com/components/laf/navigationService.js:2:192) aura_proddebug.js:242 at i.navigateTo (https://micps--cpsuat.lightning.force.com/components/laf/navigationService.js:2:611) aura_proddebug.js:242 at SampleWireContextEventWarning.[Navigate] (https://micps--cpsuat.lightning.force.com/components/force/navigation.js:2:415)

  • 1
    Please post the messages from the console as text instead of a screenshot. Thanks – glls May 15 at 20:32
  • The error message is very succinct, what about it confuses you? Also, please provide more code to show what exactly what you are doing. – gNerb May 15 at 21:37
  • @gNerb.. I've updated the question with a sample component. Is the warning still succinct? – wesfaith May 16 at 14:04
  • This is a much better question, good job on your update. The update does show that what you see is a warning and not an error. This means that it is probably not that big of a deal. You show here that the navigation does in fact happen. As far as I can tell, the code you have posted here works. This would mean that your issue lies somewhere else in your code. – gNerb May 16 at 16:24
  • Agree. I ruled out the possibility of something else causing this warning. If I just comment out the "this[NavigationMixin.Navigate]..." line in the JS file, then the warning does NOT appear. So it has something to do with this line. – wesfaith May 16 at 19:28
1

LWCs are not fully supported in the Console at the time. You will need to put your LWC in an Aura Component wrapper for it to work. See the LWC Developer Documentation for more on this. I would expect this to be the source of the errors you are seeing.

From the Docs:

Lightning Web Components doesn’t currently support these Salesforce experiences and tools. To use a Lightning web component with these experiences and tools, wrap the component in an Aura component.

  • Lightning Out
  • Lightning Components for Visualforce
  • Standalone Apps
  • Salesforce Console (Navigation Item API, Workspace API, UtilityBar API)
  • Utility Bars
  • URL Addressable Tabs
  • Flows
  • Snap-ins Chat
  • Lightning for Gmail, Outlook Integration
  • EMP API, Conversation Toolkit API, Omni Toolkit API, Quick Action API
  • Standard Action Overrides, Custom Actions, Global Actions, List View Actions, Related List View Actions
  • Chatter Extensions
  • Thanks @crmprogdev.. probably this is the reason for the warnings.. – wesfaith May 19 at 23:26
  • 1
    If you've not put your LWC in an aura component wrapper, I think you can pretty much count on it. They're not expected to work properly at this time in the console. – crmprogdev May 21 at 15:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.