I want to render data from third party api’s under the title of the topic for each them in topic list page. Can someone guide me how can I render data using best practices?
As I am don’t know much about the customization in discourse. Any advice would be great help and be appreciated!
Thanks @Lilly. Actually, I want to display some data from third party API for each topic and for that I am looking for a way to call the third party api when data load on list page.
So, when the page loads I should be calling the api and then I want to render data. At the moment I am gethering all the list data and calling third party api whatever data comes I just append that data in DOM. But I want to fetch data on lazy load of topic list page.
This is generally a bad idea. If the host serving the API is slow, your forum will be slow. If the host serving the API is down, your forum will be down. If your forum is overwhelmed, the API will be overwhelmed.
You should load the data asynchronously, for instance in a sidekiq job, and store it with the topic.
I know it’s a bad idea but I am new to discourse so didn’t know much about it. Now, I will look for the sidekiq job as you suggest.
I do have one more question. Will sidekiq job be able to figure out if there is a new data coming in for the topic list page? or do I have to do something differently to let the job know that list page loads more data?