1

I have 2 lightning components. I am displaying list of parent on the first component. when I click on the any specific parent I am displaying all associated child for that parent in the 2nd component. I am using event to pass selected parent from component 1 to component 2. I am displaying loading spinner when user select(click on) parent record, until 2nd component is rendered. The issue is if number of records on the first component is high, spinner display is getting delayed. Delay is dependent on the number of records being displayed on the current component(Component 1). Does anybody know solution for this issue?

2
  • Welcome to SE. please edit your question and add your component code.
    – Himanshu
    Apr 13, 2017 at 6:51
  • Are you displaying the spinner before doing your server call ? Apr 14, 2017 at 12:15

2 Answers 2

3

The aura:waiting event isn't a good way to go because:

We don't recommend using the legacy aura:waiting event except as a last resort. The aura:waiting application event is fired for every server request, even for requests from other components in your app. Unless your component is running in complete isolation in a standalone app and not included in Lightning Experience or Salesforce1, you probably don’t want to handle this application event. The container app may fire server-side actions and trigger your event handler multiple times.

You will need to solve the problem in your own code e.g. you could run the spinner in the second component whenever no records are set in it so it starts up with the spinner.

1

You need to use following events.

enter image description here

This events fired when framework make AJAX request in server.

3
  • See the caution in the aura:waiting documentation. Probably not a good idea to recommend this approach...
    – Keith C
    Apr 13, 2017 at 9:49
  • I agree with @KeithC, this should not be used anymore. Apr 13, 2017 at 12:23
  • If other components in page make AJAX requests these events isn't better solution...
    – TPEHEP
    Apr 13, 2017 at 12:32

You must log in to answer this question.

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