Zum Inhalt springen

Lifecycle Hook Registration (ARCH3323)

Dieser Inhalt ist noch nicht in deiner Sprache verfügbar.

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>