Skip to content

Lifecycle Hook Registration (ARCH3323)

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>