2

I'm building a Lightning component that loads data in from a record, and shows a outputRichText control. When user clicks Edit, I want to hide the outputRichText and replace it with inputRichText.

The Lightning Data Service preview (<force:recordPreview>) is loading the record data.

The <aura:if> on line xx causes a Maximum call stack size exceeded error when clicking the Edit button. It works correctly if I do not use the LDS <force:recordPreview> but instead load the content via an Apex controller or pass it in via an attribute.

Any tips?

Lightning Component:

<aura:component>
<aura:attribute name="passage" type="ProposalPassage__c"/>
<aura:attribute name="index" type="Integer"/>
<aura:attribute name="passageId" type="String"/>
<aura:attribute name="record" type="Object"/>
<aura:attribute name="recordError" type="String"/>
<aura:attribute name="edit" type="Boolean" default="false"/>

<h3>
    <b><u>{!v.record.Name}</u> [{!v.passageId}]</b>
</h3>

<force:recordPreview aura:id="recordLoader"
  recordId="{!v.passageId}"
  layoutType="FULL"
  targetRecord="{!v.record}"
/>


<!-- Display Lightning Data Service errors, if any -->
<aura:if isTrue="{!not(empty(v.recordError))}">
    <div class="recordError">
        <ui:message title="Error" severity="error" closable="true">
            {!v.recordError}
        </ui:message>
    </div>
</aura:if>

<aura:if isTrue="{!not(v.edit)}">
    <ui:outputRichText aura:id="outputRT" value="{!v.record.Content__c}"/>
    <ui:button aura:id="editButton" press="{!c.editPassage}" label="Edit"/>
    <aura:set attribute="else">
      <ui:inputRichText aura:id="inputRT" value="{!v.record.Content__c}"/>
      <ui:button aura:id="saveButton" press="{!c.savePassage}" label="Save"/>
    </aura:set> 
</aura:if>    

Error thrown on clicking Edit button:

Uncaught rerender threw an error in 'markup://c:PassageEditor' [rerender threw an error in 'markup://aura:if' [Action failed: ui$inputTextArea$controller$valueChange [Maximum call stack size 
exceeded]]]

throws at https://[instance].lightning.force.com/auraFW/javascript/OL4p-
dZcNLX81ew5xztHyw/aura_proddebug.js:10405:7

Error  
    at new <anonymous> (https://[instance].lightning.force.com/auraFW/javascript/OL4pdZcNLX81ew5xztHyw/aura_proddebug.js:4042:23)

    at https://[instance].lightning.force.com/auraFW/javascript/OL4p-dZcNLX81ew5xztHyw/aura_proddebug.js:1:1
1
  • Not sure if this is what's causing it, but if you're going to change the record, you need to pass mode="EDIT" to the force:recordPreview, or else it will throw when you try to save. (developer.salesforce.com/docs/atlas.en-us.lightning.meta/…). There might also be errors on load you're not seeing because you need to set targetError="{!v.recordError}" in the force:recordPreview. Dec 13, 2016 at 18:54

1 Answer 1

1

I've brought this to the attention of the owners of force:recordPreview in Salesforce R&D - do you have a support case open on this I could reference?

2
  • 1
    I don't have an open support case, but I can create one if it would help. Dec 12, 2016 at 20:28
  • Yes please - cases provide the feedback loop with all of the organizations involved including you. Dec 13, 2016 at 11:35

You must log in to answer this question.

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