Hi all,
I’ve been quite interested in the custom code block within Softr as it helps a lot with overcoming the limitations of the platform.
This may be a very specific niche use case, but one of my custom code block requires data from an airtable field for it to execute correctly.
Context:
My goal was to build a “news feed” tool where my clients can views articles based on their industry and keep updated. Ofcourse, it is unrealistic to be adding news articles into an Airtable database as new articles added will eat up my API limits. Hence, I’ve actually created a field with “RSS Feed” URLs in Airtable so that the custom code can read the XML assigned to the specific client to display this as a news feed.
Ofcourse, allowing the custom code block to access your Feed is a huge security risk as it can expose this to the console. Hence, my solution was to have this RSS Feed XML field displayed in a “hidden” list block so that the custom code block can access this.
This works flawlessly (see image), and without any security concerns as the custom code now simply serves as just a “frontend” to display the XML feeds, no direct access to my Airtable at all.
Where I need your help:
While this system works really well, I have noticed in a few random instances that due to a timing issue with the Airtable List block being accessible and the Custom code execution time, that sometimes the News Feed would not appear.
This is due to the code using “Getrecords” likely executing before the list block has entirely loaded, it assumes there is not records at all, and ends up not displaying anything.
This has unfortunately been the only part of the code that has left me pretty stumped, and hence why I am reaching out to the forum about this.
What is the best practice way to fix this timing issue with the List block loading so that it is always before the custom code block executes. If you can let me know how does softr custom code block loading works, and best practices, I should be able to fix my code myself.
Any help is much appreciated! It’s a bit difficult to explain my situation, so if you need any clarification, feel free to ask!
Thanks.