Skip to content

Instantly share code, notes, and snippets.

@StevenGFX
Last active February 23, 2024 18:49
Show Gist options
  • Save StevenGFX/30ca87488d340053173b71d162643554 to your computer and use it in GitHub Desktop.
Save StevenGFX/30ca87488d340053173b71d162643554 to your computer and use it in GitHub Desktop.
Nuxt 3 Watch Force Update

Component

const forceUpdate = ref(0);

watch(() => activeRoleFilters, () => {
  forceUpdate.value++; // Increment to force reactivity
}, { deep: true });

Template

In template, use forceUpdate in a way that it's evaluated, e.g.,

<div :key="forceUpdate">

</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment