You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Discussing with @yyx990803, it is preferred to not introduce new attributes to <script setup> while we used nuxt keyword to add defineNuxtComponent wrapper that allows using asyncData without await and handles enqueued promises but wrapping every component also doesn't make sense since usually, only some components have data fetching logic and the additional ticks overhead to the rest of components affects overall performance as we introduce more logic into defineNuxtComponent.
Some ideas:
Keep using nuxt
Use <script setup> and wrap all (ignore perf)
Use <script setup async> (new convention adding to SFCs)
Auto-detect wrapper requirement based on syntax usage ([useAsyncData,useFetch] -- extendable) and require explicit await for composables
Introduce additional await nuxtPromises() utility to be used at the end of the file
Discussing with the team (@atinux@antfu and @danielroe) auto detect and using <script setup> again is best option so far. Yet we can think of other aspects.
On a related topic, @yyx990803 also mentioned it is more preferred if we keep using <script setup> (over options API) in the examples. We can only use explicit defineNuxtComponent with options API in sections that need backward compatibility and automated migration scripts in order to keep supporting legacy options like asyncData, fetch, transition, etc
Activity