Editorial question149.1K views1,773 votes0 answers1,599 following
AI-generatedDoes AlpineJS support awaiting asynchronous functions in x-init?
AlpineJS allows the x-init directive to execute logic when a component initializes. However, the framework currently invokes these functions synchronously. If an async function is passed to x-init , the resulting Promise is treated as fire-and-forget, meaning the component continues its lifecycle without waiting for the asynchronous operation to resolve. Thi