Timeline for LWC failing to call Apex class/method
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Mar 16, 2021 at 11:55 | vote | accept | Jonathan Fox | ||
Mar 16, 2021 at 11:55 | answer | added | Jonathan Fox | timeline score: 0 | |
Aug 27, 2020 at 16:03 | comment | added | Jonathan Fox | Thank you for your suggestions and explanations. I shall update my code this evening and let you know/update this thread! | |
Aug 27, 2020 at 13:44 | comment | added | arut | This way you would be breaking down your code into simple re-usable components. If you are running into issues doing this, let me know. Also, there could be other ways to do this. | |
Aug 27, 2020 at 13:44 | comment | added | arut | My suggestion would be to create a separate progress bar component (with a refresh icon button) and use it your code. Refer to the sample shown in the documentation section here: developer.salesforce.com/docs/component-library/bundle/…. This child component could dispatch a custom event on click of the refresh button (or automatically after certain interval) to the parent component (asking to fetch the latest job status) and the parent component could send the information to a public method in the child component. | |
Aug 27, 2020 at 12:53 | comment | added | arut |
The connectedCallback isn’t initiated until the createRecords happened so there will always be a JobID won’t there ... You are right about the jobID here but connectedCallback is a life cycle hook that will execute anytime an insertion occurs in DOM. So, lets say the createRecords called the connectedCallback and then some user action caused an update in the DOM, connectedCallback would get called again. So, another setInterval callback will be queued up leading to redundancy. While I would still look for another approach, I doubt if this code is the right way.
|
|
Aug 27, 2020 at 12:39 | comment | added | Jonathan Fox | Hi there! The connectedCallback isn’t initiated until the createRecords happened so there will always be a JobID won’t there? I do apologise my inexperience if I am wrong! - Ideally I want the full batchJob record so I can find the difference between totalJobItems and Completed to work out the percentage for the loading bar. | |
Aug 27, 2020 at 12:37 | comment | added | arut |
[Violation] 'setInterval' handler took xx ms usually means that the function took more time to execute than expected (causing UI performance issues). Are you trying to show only the batch job status only? I'm doubt if placing this code inside connectedCallback is the right approach since a hard (browser) refresh would give you a null jobId.
|
|
Aug 27, 2020 at 8:37 | history | edited | Jonathan Fox | CC BY-SA 4.0 |
deleted 5 characters in body
|
Aug 27, 2020 at 8:29 | history | edited | Jonathan Fox | CC BY-SA 4.0 |
added 29 characters in body
|
Aug 27, 2020 at 8:24 | history | asked | Jonathan Fox | CC BY-SA 4.0 |