Aller au contenu

Lifecycle Hook Registration (ARCH3323)

Ce contenu n’est pas encore disponible dans votre langue.

Key typescript.vue.lifecycle-registration · Severity error · Category quality

Vue: flags onMounted and friends registered conditionally or after an await. Vue binds lifecycle hooks to the component being set up at that moment, so the hook never runs.

<script setup lang="ts">
const settings = await loadSettings();
onMounted(() => focusSearch());
</script>
<script setup lang="ts">
onMounted(() => focusSearch());
const settings = await loadSettings();
</script>