Dev48
Language
  • About
  • Services
  • Industries
  • Technologies
  • Articles
  • Contacts
Book a call
    Home/Articles/Quiet quality of life wins in vue 35
Dev48
info@dev48.org+375 29 320-40-96WhatsApp@isky_by

© 2026 · All rights reserved.

Quiet Quality-of-Life Wins in Vue 3.5

Source: Telerik Blogs•November 25, 2026 at 07:29 PM

Quiet Quality-of-Life Wins in Vue 3.5

Vue 3.5 was a minor release, but it came with some nice quality-of-life upgrades worth exploring. Here’s what one Vue developer uses daily.

Vue 3.5 was a minor release, but it came with some nice quality-of-life upgrades worth exploring. Here’s what one Vue developer uses daily.

Back in 2019, I wrote How to Target the DOM in Vue, which was all about ref and the edge cases that come with grabbing a real element out of your template. That article is old enough to have jQuery comparisons in it (👵). The interesting part is that the advice barely changed for five years, and then Vue 3.5 quietly changed a piece of it.

Big Vue releases get a blog post, a conference talk and a week of discussion. Minor releases get a changelog that most of us skim on the way to fixing something else. Vue 3.5 shipped in September 2024 and it is full of small things that remove a line or two of boilerplate from files you touch every week.

We’ll go through useTemplateRef, useId, reactive props destructure, onWatcherCleanup, deferred Teleport and lazy hydration, and for each one I want to show you the annoying thing it replaces.

Template Refs by Name with useTemplateRef

Let’s start with template refs, since that’s where we came in. Here is the shape you have written a hundred times.

MessageBox.vue

This works because of a compiler trick. Vue looks at the ref="composer" attribute, finds a top-level variable in your <script setup> block called composer, and wires the two together for you. The name match is the whole mechanism.

That match is also the limitation. The ref attribute has to be a static string, and your variable has to be named exactly the same thing.

Vue 3.5 adds useTemplateRef, which takes the name as a regular function argument instead.

MessageBox.vue

Let’s break it down. useTemplateRef('composer') gives you back a shallow ref, and Vue points it at whichever element is tagged ref="composer". The value is null until the component mounts, and it goes back to null when the element is unmounted or hidden by a v-if.

Notice that the variable is now called el and nothing broke. The string is what binds, so you can name the variable whatever reads best.

One detail worth knowing. The ref you get back is typed readonly, and Vue warns you if you assign to it in development. That’s a feature! Vue owns that value, and in the old pattern nothing stopped you from accidentally clobbering it. More safe, more better, I guess.

The part we actually care about is that the name can now come from outside the component, like an argument to a composable.

useCursorAtEnd.js

That one focuses a field and drops the cursor after the existing text, which is what you want for a rename box or an inline edit.

Focusing a field doesn’t promise you anything about where the cursor lands. Browsers differ, so the user can end up at the start of the text or with the whole value selected, and either way they have to fix it before typing. Setting the range yourself is the only way to be sure.

Big disclaimer though. setSelectionRange only works on fields that support text selection, which means a textarea or an input of type text, search, url, tel or password. Point it at an input type="email" or an input type="number", and the browser throws an InvalidStateError instead. That’s what the SELECTABLE check is doing, because this composable takes the field name from the caller and can land on anything.

Now any component can call useCursorAtEnd('composer') and the composable finds the element on its own. It never has to care what that element is called, and you don’t have to declare a ref in the component just to hand it over.

The ref attribute can also be a dynamic binding, so the name can be computed at runtime instead of hardcoded in the template. For a name that genuinely keeps changing, a function ref is still the tool, and it’s clunkier to write.

One rule though: call useCursorAtEnd (or whatever your composable is called) at the top of your setup block. It reads the active component instance when it runs, so calling it from inside onMounted is already too late. Vue has placed the element by then, and a ref you set up at that point stays null until the next update.

To be quite honest with you, I don’t think the plain ref(null) version is going away, and I don’t plan to rewrite existing components. For a one-off focus call in a single file, it’s fine and it’s shorter. I reach for useTemplateRef when the name needs to travel, which in practice means composables.

Unique IDs Without Hand-Rolling Them

Here’s a problem that has annoyed me for years. You build a reusable form field, and you need to connect the <label> to the <input> with a matching for and id pair. That pair has to be unique on the page, and a reusable component has no idea how many copies of itself exist.

So we usually have to improvise, I’m sure you’ve shipped at least one of these.

The counter works until you server-render. The server and the browser each start counting from zero at their own moment, so the two IDs don’t match and you get a hydration mismatch.

The random string is worse, since it produces a different value on every single render. The required prop works fine, but it pushes a boring detail onto everyone who uses your component.

Vue 3.5 gives us useId.

FormField.vue

useId() hands you a fresh string every time you call it, and no two calls anywhere in the app produce the same one. That is true whether you call it twice in one component or render 20 copies of the same field. The reason it’s worth switching is that the server and the browser agree on the value, so nothing mismatches during hydration.

Two caveats before you go sprinkling it everywhere.

First, don’t call useId() inside a computed(). A computed only runs when something reads it, and useId() reads whichever component is active at that moment, which may not be yours. The server and the browser won’t reach that first read at the same point either, so you’re back to a hydration mismatch. Call useId() once in your setup block and read that variable from the computed.

Second, if you mount more than one Vue app on the same page, the generated IDs can collide across apps. There’s a config for that, and you set it per app.

main.js

Every ID from that app now starts with checkout-, so it can’t clash with IDs from the app next to it.

Reactive Props Destructure Became the Default

This one changes the meaning of code you may already have written, so it’s the one to read carefully.

In Vue 3.4 and earlier, destructuring props like that quietly broke reactivity. You got the value at setup time, frozen forever, and updating the prop from the parent did nothing. It was a well-known footgun.

In 3.5 the compiler rewrites every access to a destructured prop back into props.total for you, so it’s reactive and updates normally.

The nice side effect is that prop defaults are now just JavaScript default values, which is a lot more pleasant than a default key in an options object. It’s especially nice with type-based declarations, where you used to need withDefaults.

Big disclaimer though. Reactivity survives inside your template and inside computed properties, but the moment you pass a destructured prop as an argument to a function, you’re handing over a plain value and the tracking stops.

Same rule for your own composables. Hand over () => userId instead of userId. Inside the composable, toValue() will unwrap it for you and keep the dependency tracked. If you already write composables that accept getters, nothing changes for you.

This last bit may be something worth linting for in big codebases.

onWatcherCleanup for Cancelling Work in Flight

Watchers that kick off async work have always needed a way to cancel the previous run. The old approach was the third argument of the watcher callback, usually called onCleanup. Vue 3.5 adds onWatcherCleanup as an import, so the cleanup registration is a normal function call instead of a parameter you have to remember to accept.

SearchResults.vue

This abort-the-previous-request shape is the one the Vue docs use in their side effect cleanup section, and their version is worth a read too.

Let’s break it down. Every time query changes, we build a fresh AbortController and register its abort as the cleanup for this run.

If the user types another character before the request comes back, Vue runs the cleanup first, the in-flight request is aborted, and only then does the new callback start. No more race where an older response lands after a newer one and overwrites your results.

Notice where the onWatcherCleanup call sits. It has to run during the synchronous part of the callback, which means before the first await. Put it after the fetch, and it will not register, because by then Vue has moved on and no longer knows which watcher you mean.

Vue does warn you in development rather than failing quietly, so check your console if a stale request sneaks through. If you genuinely need to register cleanup after an await, keep using the onCleanup parameter, which doesn’t have that restriction.

The catch block is there because aborting a fetch makes it reject with an AbortError. That rejection is expected, so we swallow that one and rethrow everything else.

Deferred Teleport

<Teleport> has always had one rule that surprises people. It looks for its destination the moment it mounts, and if that element isn’t on the page yet, it gives up. So this fails.

AppLayout.vue

The <div> is right there in the same template. But Teleport looks for its target during the same mounting pass, and at that point the <div> doesn’t exist yet. The usual workarounds were moving the target into index.html or wrapping things in v-if plus nextTick.

Vue 3.5 adds a defer prop that waits until the current render cycle finishes before looking for the target.

AppLayout.vue

That’s the whole fix, and it kills the ugliest workaround on this list.

One limit to know about. The wait is short. defer holds off until the current render pass is done, and that’s it, so the target still has to exist by the time that pass ends. A container that only appears once a fetch resolves is already too late, and you get the same missing-target error you started with.

The place I actually use defer is layout components that own their own portal containers, since forcing those containers into the root HTML file feels wrong.

Lazy Hydration, If You Server-Render

Last one, and it only matters if you’re doing SSR. Normally every component in a server-rendered page gets hydrated as soon as the JavaScript loads, whether the user can see it or not. A comments section three screens down costs you the same startup work as the thing at the top of the page.

Vue 3.5 lets an async component decide when it hydrates.

CommentsPanel.js

Now the markup ships and renders, but the component isn’t hydrated until it scrolls near the viewport, so nothing inside it is interactive yet. There are four built-in strategies.

  • hydrateOnVisible(options): hydrates when the element comes into view, using IntersectionObserver. The options go straight to the observer, so rootMargin lets you start early. This is my default for anything below the fold.
  • hydrateOnIdle(timeout): hydrates inside a requestIdleCallback, and you can cap how long it’s willing to wait (it defaults to 10 seconds). Good for widgets that sit off to the side but still get clicked.

The other two are hydrateOnInteraction(events), which waits for an event and then replays it so the first click isn’t lost, and hydrateOnMediaQuery(query), which stays asleep until the media query you give it starts matching.

Notice that hydrateOnVisible is its own import. That’s on purpose, so your bundle only ships the strategies you actually use.

Wrapping Up

None of this is going to change how you build Vue apps. That’s the point of a minor release. What it does is remove six small annoyances, and three of them (useId, reactive props destructure and onWatcherCleanup) show up in the kind of code I write almost every day.

If you’re on 3.4 and you skipped the upgrade, the reactive props destructure change is the one to look at first, since it turns a footgun into working code.

If you’re already on 3.5 or later without knowing what came with it, go rewrite one form field with useId and enjoy deleting the counter.

Happy upgrading!

Have you explored the Progress Kendo UI for Vue component library yet? It comes with a free 30-day trial, so go for it!Try Now

Have you explored the Progress Kendo UI for Vue component library yet? It comes with a free 30-day trial, so go for it!

Try Now

← All articles

What this article says

More in Software Development

All →
5 ways customers are already innovating with Salesforce in Claude
Salesforce Commerce

5 ways customers are already innovating with Salesforce in Claude

Endava Becomes Anthropic Select Partner
Endava

Endava Becomes Anthropic Select Partner

Kotlin Heroes: Episode 15 – Anniversary Edition
JetBrains

Kotlin Heroes: Episode 15 – Anniversary Edition

5 EHS Myths That Challenge How Organizations Think About Risk | Veeva
Veeva Systems

5 EHS Myths That Challenge How Organizations Think About Risk | Veeva

How Alpenglow Sports got its fall catalog AI-ready in two weeks
Fabric

How Alpenglow Sports got its fall catalog AI-ready in two weeks

Outcome per dollar is the frontier. We’re advancing it at every layer: FLOPs-efficient pretraining (MAI Base 2), long RL climbs (Rocket), and token-efficient models (7 new MAI models announced last week) [Read more]
Microsoft

Outcome per dollar is the frontier. We’re advancing it at every layer: FLOPs-efficient pretraining (MAI Base 2), long RL climbs (Rocket), and token-efficient models (7 new MAI models announced last week) [Read more]

More from Telerik

Enhancing Blazor User Experience with Prebuilt Editors
Telerik

Enhancing Blazor User Experience with Prebuilt Editors

What Makes an Application Agentic?
Telerik

What Makes an Application Agentic?

Understanding AI Agents
Telerik

Understanding AI Agents

Build This Secret Santa UI in .NET MAUI
Telerik

Build This Secret Santa UI in .NET MAUI

Better Auth with Nuxt and SQLite
Telerik

Better Auth with Nuxt and SQLite

Generic Components for Vue 3
Telerik

Generic Components for Vue 3