1

I am working on a feature with multiple lightning web components. Component A displays a list of custom object records and component B displays the details of individual record in multiple tabs.

Component A fires an event using the pubsub model to render the second component with the related record's data.

In component B, I have two tabs. The first tab uses the lightning-record-view-form to display some data related to the record selected and second tab uses the lightning-record-form to display all data of the selected record.

When the second tab is selected in component B and a new record is selected in component A, it gives the following error.

[Cannot read property 'apiName' of undefined]

Note: The tab does render correctly when I close the error message. I can see that the lightning-record-form displays the new record data that is selected but, it always displays this error message.

If I replace the lightning-record-form in second tab with lightning-record-view-form it works fine.

I am not sure what I am missing here.

Any help is really appreciated. Please let me know if any additional info is needed.

Thanks Ravi

1
  • Not sure what else to do--I'm deleting my answer to give you question a better chance to get a better answer. You might want to add some code of what you've got so far.
    – sfdcfox
    Mar 9, 2020 at 16:02

1 Answer 1

0

I was able to figure out a solution for this. By adding a delay in the JS method that is called in component B when an event is fired from component A and displaying a spinner in component B the lightning-record-form worked fine.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .