Skip to main content

Questions tagged [lightning-web-components]

This tag is for questions related to JavaScript, CSS, or Markup when used in the Lightning Web Component (LWC) programming model, or for questions of interoperability between LWC and the original Aura-based lightning components.

Filter by
Sorted by
Tagged with
53 votes
8 answers
38k views

Target inner elements of standard Lightning Web Components with CSS

Say we have a LWC with the following template in a component named example: <template> <lightning-textarea class="test"></lightning-textarea> </template> And some css to ...
Benjamin Vogler's user avatar
47 votes
6 answers
93k views

Uncaught TypeError: 'set' on proxy: trap returned falsish for property Name

Am not doing anything fancy, just trying to update a field on Contact in JS of LWC but getting this exception. Uncaught TypeError: 'set' on proxy: trap returned falsish for property 'Name' throws at ...
Pranay Jaiswal's user avatar
43 votes
6 answers
133k views

Force refresh view in LWC

In Aura, we can do $A.get('e.force:refreshView').fire(); to cause standard components to update. How can we do an equivalent in LWC because sfdx refuses to publish .js code with $A in it saying ...
zaitsman's user avatar
  • 1,940
40 votes
5 answers
50k views

Expression Functions for Lightning Web Components

How can expression functions similar to Visualforce and Lightning Aura Components be achieved within lightning web components? For example, <template if:true={index % 5 == 0}><br></...
Oleh Berehovskyi's user avatar
38 votes
3 answers
7k views

How to turn boxcarring OFF for LWC imperative apex method calls?

We are running in a blocking performance issue on a page that we built using Lightning Web Components. Our page has many LWC components, each calling various apex methods via an imperative method ...
pdebaty's user avatar
  • 967
37 votes
1 answer
6k views

What are Lightning Web Components

Salesforce has just announced a new feature, Lightning Web Components. What is this? What does it have to do with Lightning Components and the Lightning Component Framework?
pchittum's user avatar
  • 19.7k
33 votes
6 answers
39k views

Dynamic component creation in Lightning Web Components

Is there any way to create and add lightning web components dynamically in the component tree ? I mean the equivalent one in Aura is $A.createComponent(). The usual Web Components can be dynamically ...
stomita's user avatar
  • 529
33 votes
1 answer
22k views

LWC setting properties in connectedCallback()

This blog is talking about things we can do with lwc connectedCallback method. It seems to contradict itself with a certain point so I am trying to make sure. They say that we can set property values ...
Michael Munta's user avatar
31 votes
2 answers
62k views

async/await functions in LWC

Assume I have an LWC component and Apex Aura controller: /* AccountController.cls */ public with sharing class AccountController { @AuraEnabled public static List<Account> getAll() { ...
user70363's user avatar
  • 435
31 votes
3 answers
12k views

Lightning Web Components - Benefits and Support

Salesforce announced Lightning Web Components in Dec. 2018. In comparison to the existing Aura Framework: What are the benefits of using Lightning Web Components? / How much faster are they? Where ...
Christian Deckert's user avatar
30 votes
4 answers
68k views

Track Input value in LWC

What I'm trying to bind a controller variable with lightning-input's value. For instance myVar So far Following all examples and documentation of LWC I'm able to do so by using the onchange method ...
Martin Borthiry's user avatar
29 votes
4 answers
30k views

LWC as QuickAction in Salesforce

I have made a quick action in lightning web component and want ot make that compponent available for quick action. I havenot found any guide or documentation regarding this. Can you please suggest on ...
Muhammad Sheheryar Afsar's user avatar
27 votes
1 answer
27k views

LWC navigation error: "this[f.NavigationMixin.Navigate] is not a function"

When attempting to use the Lightning navigation service in my component's base class (.js), I get the following error when functionally testing in the UI: this[f.NavigationMixin.Navigate] is not a ...
Brent Bowers's user avatar
  • 3,144
25 votes
3 answers
8k views

Not able to render dynamic Lightning Web Component

I am refering Play Ground to render dynamic component in LWC. But it is giving error createElement is not defined. Have any one idea how to render dynamic component. Alternative of createComponent ...
Mekyush Jariwala's user avatar
23 votes
3 answers
108k views

How do you define an element with an ID attribute using LWC?

I'd like to be able to link to certain portions of my page using URL fragments, eg: <h3 id="overview">Overview</h3> ... <a href="#overview">Go to Overview</a> Unfortunately ...
Brendan Roy's user avatar
23 votes
3 answers
28k views

Can't get refreshApex() to work in lwc

I'm not able to get refreshApex() working in an lwc. I've read the docs here -- scroll to the bottom. Here are the key elements of the js file: import { LightningElement, track, api, wire } from 'lwc'...
PatMcClellan__c's user avatar
23 votes
1 answer
4k views

Array.find and Array.findIndex has worst performance in LWC Lightning Locker

For the component chain like below: <container> <parent> <child> <grand-child> Pass an Array from container to all the way down to grand-child. This is ...
salesforce-sas's user avatar
21 votes
5 answers
40k views

Add Lightning Web Component to Lightning Tab

I am trying to figure out how to add a Lightning Web Component to a Lightning tab. I have it on the Home Page, but I would like it to be on its own tab. I feel like there should be an option to ...
Michele Kleinhomer's user avatar
21 votes
2 answers
60k views

Javscript onload in LWC

i have a requirement to call a javascript method on load of the template. is there any way to do that in LWC?
Sandeep Chilakala's user avatar
21 votes
4 answers
56k views

Lightning Web Component for table rows and cells

I'm trying to build a LWC that renders a complex table-based UI. It needs to have distinct rows and columns with dynamically-determined colspans - a real table. It's for assigning lodging, and each ...
mscholtz's user avatar
  • 1,324
21 votes
2 answers
3k views

Boxcaring is removed from LWC components?

This question is the extension of How to turn boxcarring OFF for LWC imperative apex method calls?. While taking into consideration for LWC implementations, that we do not have equivalent of action....
salesforce-sas's user avatar
20 votes
2 answers
21k views

Using unescape HTML in lightning web component

I am currently having an issue to show the content fetched from salesforce database to UI. The data is stored in HTML form and I want it to show on UI using LWC without escaping HTML. Previously we ...
Tarique Shamim's user avatar
20 votes
2 answers
40k views

How do I invoke a value change handler in LWC?

Is there a way in LWC to declare an attribute value change handler like there was in Aura? My use case is that I have a pager component which has 2 @api properties. When either of the @api values ...
Vincent Ip's user avatar
20 votes
1 answer
14k views

Chain wire methods together in Lightning Web Components

According to the documentation here in order to retrieve a list of picklist values for an object we need to pass in a Record Type Id which can be retrieved using the getObjectInfo method. The issue is ...
pbattisson's user avatar
  • 3,308
20 votes
2 answers
39k views

How to target LWC by name attribute?

During a submit I'd like to intercept the event and run some custom validation on the input values. Here is a simplified template of what I'd like to do: <template> <lightning-input type="...
Dinco's user avatar
  • 255
20 votes
3 answers
4k views

Not being able to reference packaged custom LWCs from other LWCs outside the package

This restriction referenced from Distribute Components on AppExchange: A custom Lightning web component can’t access a Lightning web component or module in a custom namespace. It can access ...
Keith C's user avatar
  • 136k
19 votes
12 answers
46k views

recordId is undefined in LWC quick action component

I have created an LWC component for quick action and also defined the @api recordId inside that. But the recordId is undefined in the component when logged. Seems like it is not being passed to the ...
Ad A's user avatar
  • 319
19 votes
3 answers
33k views

Is it possible to navigate to a Visualforce page from an LWC with parameters and community compatible

The LWC framework includes the NavigationMixin.Navigate functionality that can be used to obtain URLs or perform navigation to generated URLs. This supports a number of different page types, as ...
Phil W's user avatar
  • 36.9k
19 votes
3 answers
24k views

LWC Handling Multiple Dependents @Wire methods

How we handle dependent wire in LWC? For example : @wire(getObjectInfo, { objectApiName: OPP_OBJECT }) objectInfo; @wire(getPicklistValues, { recordTypeId: '$objectInfo.data....
Elias Pinheiro's user avatar
19 votes
1 answer
4k views

Lightning Web Components Open Source with Lightning Design System (lwc with slds)

I am trying to local development with Lightning Web Component. The https://lwc.dev works good and I want to also add the Lightning Design System style but I am getting errors. I have installed the ...
Aykut Parlak's user avatar
19 votes
1 answer
4k views

Canvas App (or equivalent) for Lightning Web Components

We are currently using the force:canvasApp lightning component to embed an external site securely into Salesforce. The Spring '19 release is introducing Lightning Web Components as the future of ...
Brian Miller's user avatar
  • 5,222
18 votes
2 answers
23k views

Order of execution of @wire in lwc

I know that @wire methods are always executed once our component is loaded. I want to dig deep into this and want to understand the order of execution with respect to the component's life cycle. When ...
Krishnan Mishra's user avatar
17 votes
1 answer
21k views

Get RecordId in LWC From Community Page

I'm trying to make a component in my community be able to pull in the record Id. I followed the information in this question: LWC Community recordId undefined And this documentation: https://...
gNerb's user avatar
  • 9,500
17 votes
2 answers
6k views

CSS animation in LWC not working

I'm unable to get a simple css fade-in-out text animation to work in LWC. The text displays on the page okay, but it does not fade in/out like expected. It seems as though the keyframes are getting ...
Scott McClung's user avatar
17 votes
4 answers
8k views

Feasibility to import entire LWC classes to access @api methods

I'm looking to modularize my LWC without having to embed them in the template. Ideally, would this kind of pattern be feasible? I'm not sure if it's my lack of ES6 knowledge (modules) or that LWC ...
tsalb's user avatar
  • 3,735
16 votes
5 answers
36k views

Lightning Web Components - Not available in app builder

I'm developing a lightning web component with org based development and I'm finding that the component isn't available in the app builder, despite (as far as I can tell) making it available in the ...
Bigears's user avatar
  • 1,131
16 votes
1 answer
48k views

connectedcallback vs renderedcallback in lightning web component

I'm new to Salesforce LWC. I'm trying to understand the LWC component life cycle methods. But it is a bit difficult to understand. Can any give a simple explanation about connectedcallback() and ...
RKCY's user avatar
  • 323
16 votes
2 answers
14k views

How to show hyperlink in LWC toast

I have created a LWC that executes a call to the controller and shows a toast message if the call fails: const event = new ShowToastEvent({ title: "Error", ...
Teodora's user avatar
  • 465
16 votes
4 answers
29k views

Get records in Lightning web components without APEX

import { LightningElement, track, api, wire } from 'lwc'; import { getRecord } from 'lightning/uiRecordApi'; const FIELDS_SOLICITUD = [ 'DCABM_obj_solicitudABM__c.DCABM_fld_aplicacionSolicitud__c'...
Alex M.'s user avatar
  • 534
15 votes
3 answers
14k views

Handle click outside element in LWC

I am looking to create a custom lookup component using Lightning Web Components. I want to be able to detect when the user is clicking outside of the element so that I can close the dialog and/or ...
BiscuitKnees's user avatar
15 votes
2 answers
2k views

Modularize (existing) LWC for reuse and flexible distribution

I am currently breaking a monolithic 1GP Managed package into more modular 2GP packages. While doing this I also want to decompose chunky LWC components in a way so they can be reused more flexibly ...
Robert Sösemann's user avatar
15 votes
5 answers
6k views

What is involved in moving over to Lightning Web Components?

I read: Aura Components, leveraging its own component model, templates, and modular development programming model. Lightning Web Components, built on top of the web standards breakthroughs of the ...
Keith C's user avatar
  • 136k
15 votes
1 answer
14k views

how to pass parameter to apex method which is called imperatively from lightning web component

I'm working on one LWC and facing issue while passing parameters to an apex method which I am calling imperatively on selection of a record in datatable. I'm able to get selected recordid in JS ...
Ashish Sharma's user avatar
14 votes
2 answers
65k views

Hyperlink record name LWC datatable

I am trying to fetch List of sobjects and show them in data table. I want to add a hyperlink to record name. I am using @wired property to dynamically get records depending on the search term. my test....
SFlearner's user avatar
  • 151
14 votes
6 answers
19k views

lightning-datatable - remove header actions

Is it possible to remove the header (column) actions completely from lightning-datatable? It seems that no matter what I do I'm still stuck with Wrap Text and Clip Text actions. UPDATE Adding more ...
smukov's user avatar
  • 5,603
14 votes
3 answers
33k views

NoErrorObjectAvailable Script error

I have a LWC that is used in different orgs. In one of them, when I dispatch an event like: this.dispatchEvent( new CustomEvent( 'press' )); I am getting the [NoErrorObjectAvailable] Script error in ...
Gabriel Serrano Salas's user avatar
14 votes
3 answers
11k views

How to refresh wired service getRecord manually?

Please note that this is not duplicate of LWC Force Refresh Wire getRecord - this question and answer specifically speaks about changes in front-end/UI and capturing that in front-end BUT LDS cannot ...
salesforce-sas's user avatar
14 votes
1 answer
4k views

LWC and complex parameters

I am trying to pass a list of objects to Apex from an LWC controller, and it looks like the Apex controller is getting the right sized list, but nothing is populated. Does anybody have any idea of ...
Sebastian Kessel's user avatar
14 votes
1 answer
14k views

Log to console in a Lightning Web Component

I am attempting to write a Lightning Web Component, but continually run into errors in my Javascript that I can't debug. I've been trying to log my error but when I put console.log() anywhere in the ...
BlondeSwan's user avatar
  • 1,098
14 votes
1 answer
11k views

Understanding shadow dom in Lightning web components

I'm looking at the shadow Dom in the lwc developer guide and found below statements. Shadow DOM is a web standard. To make development easier for component authors, the Lightning Web Components ...
Hemavantha Rajesh Varma Mudunu's user avatar

1
2 3 4 5
176