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