Last active
January 23, 2018 23:11
-
-
Save dsharrison/5d49a601f5bc04cef792a4e94479ebcf to your computer and use it in GitHub Desktop.
Reproduction components for a Spring '18 issue with virtual classes and lightning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class MyOverrideClass extends MyVirtualClass { | |
@auraEnabled | |
public override String getName() { | |
return 'MyOverrideClass'; | |
} | |
@auraEnabled | |
public override Object getObj() { | |
return 'Hello World'; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public virtual class MyVirtualClass { | |
@auraEnabled | |
public virtual String getName() { | |
return 'MyVirtualClass'; | |
} | |
@auraEnabled | |
public virtual Object getObj() { | |
return 99; | |
} | |
@auraEnabled | |
public Integer getVirtualOnlyValue() { | |
return 1; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<aura:component controller="VirtualClassTestController" implements="forceCommunity:availableForAllPageTypes" access="global" > | |
<aura:attribute name="dataString" type="String" access="PRIVATE" /> | |
<aura:handler name="init" value="{!this}" action="{!c.doInit}" /> | |
<lightning:card title="Spring '18 Issue Reproduction"> | |
<p class="slds-m-vertical_small">We should be seeing a <code>name</code> value of "MyOverrideClass" and an obj of type String with a value of '11'</p> | |
<h2 class="slds-text-heading_small">Data</h2> | |
<pre>{!v.dataString}</pre> | |
</lightning:card> | |
</aura:component> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class VirtualClassTestController { | |
@auraEnabled | |
public static MyOverrideClass getClass() { | |
return new MyOverrideClass(); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
({ | |
doInit : function(component, event, helper) { | |
var action = component.get('c.getClass'); | |
action.setCallback(this, function(response){ | |
var data = response.getReturnValue(); | |
component.set('v.dataString', JSON.stringify(data)); | |
}); | |
$A.enqueueAction(action); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment