What is the best practice for asynchronously loading component data?

Ok, so since I read what @rsmahmud did yesterday I was thinking how I would do the same thing, using just:

  • components
  • timer components
  • background tasks

Today I made a short example of async like behavior that does what @rsmahmud wants, but uses background tasks instead:
async_with_timers

It can still be optimized further, especially if used with other techniques to chunk the server calls into blocks that only cover what the user might want to see on one page (like a lazy loading type behavior, etc.)

Anyway, here is a clone link, I made it as simplistic as possible to show off background tasks:
https://anvil.works/build#clone:OOPMWD7B4KU6QFH5=CLKCEKTKVAIOZA5YFPFWKBGL

2 Likes