1

I'm using a url button to redirect to a lightning component which has been implemented using lightning:isUrlAddressable.

The url button to redirect on lead is as : /lightning/cmp/c__componentName?c__leadId={!Lead.Id}

But the leadId when I try to obtain in Init is cached and hence getting the previous leadId instead of the current LeadId.

How to get to get the current leadid instead of getting cached value??

1 Answer 1

7

Yes, this is the issue with lightning:isUrlAddressable It's not refreshing the view.

To resolve this Use change aura:handler of pageReference to call the same init method.

Example

 <aura:handler name="init" value="{!this}" action="{!c.init}" />
 <aura:handler name="change" value="{!v.pageReference}" action="{!c.init}" />

or else you can also refresh your view using force:refreshView event

  <aura:handler name="change" value="{!v.pageReference}" action="{!c.reInit}" />

  reInit: function(component, event, helper) {
    $A.get("e.force:refreshView").fire();
  }
1
  • Thanks a lot Sarvesh. This works :) Mar 24, 2020 at 6:17

You must log in to answer this question.

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