Vue 3.3.6 released, it’s faster thanks to WeakMap

Performance improvements and type checking of additional properties of DOM nodes make the new Vue worth updating. The Vue team has really done a lot of work. In fact, they released two sub-versions on the same day. Vue 3.3.5 and 3.3.6 are both released on October 20, 2023.

WeakMaps

One of the improvements was the move from Maps and Sets to WeakMaps and WeakSets where possible.

What is that and why is it important?

If you store things in Maps or Sets, you will make a reference to those things. This means that as long as Map or Set is used, this thing will not be released from memory by the garbage collector.

Usually this makes sense. But sometimes not. Especially when you’re writing some code that’s just deep into the normal workflow of the data. For example, by adding diagnostic data to the data flowing through the system.

You want the data to be released when you need it, you don’t want to retain the right to retain the data.

This is where WeakMaps and WeakSets come into play, Vue now uses these more internally to prevent memory leaks and improve overall performance.

Support for contenteditable=”plaintext-only”

I think contenteditable can be true or false. But apparently, there is a third value "plaintext-only".

Normally, when you set the parameter to true, you can also edit the format and paste rich text. Using the plaintext-only value does not work.

The change now is that Vue will not throw Typescript errors for legal values defined in the HTML specification.

Lazy loading of images

Again, this is just type support for HTML features. It was added in 3.3.5 and enables you to set the img’s load parameter to lazy.

This way, the image doesn’t load immediately, but when your browser decides you’ll be able to see it soon.

This is a standard HTML feature that has been around for a while, but this fix is a good reminder to use it to improve application performance.

There are other bug fixes and performance improvements in this release.

New features in Vue 3.2.40

The latest version of Vue, the popular web framework, was released on September 28, 2022, providing developers with bug fixes in preparation for version 3.3.

Button incorrectly disabled

c737bb51e3decdd4bee944c08d20ad84.png

The code above illustrates that the button should not be disabled because “false” in the attribute is actually a string, not a boolean. In the latest versions of Vue, it’s fixed by checking the type of the property.

V-on does not throw errors

7107471b002780c774ab4d8be93bf4c8.png

The code above and similar ones were recently throwing errors when they should have been working fine, and it’s been fixed.

Events are triggered correctly

24ef1ba7194bb6e5f9870f128311f07c.png

The above code does not cause onBlur to be called, but it should be called. The merging of dynamic and static v-on caused this bug to disappear.

Fixed a memory leak

38323c11a2e132dbb6080559c7886cab.png

In the above case, the memory is not cleaned properly in the dev scene. It is caused by promoted vnodes improperly retaining DOM nodes. It’s fixed now too.

These are the most interesting fixes, a number of other SSR-related issues have also been fixed and the team is working hard on it.

The 3 most interesting bug fixes for Vue 3.2.41-45

The Vue team didn’t take a break last month. Vue 3.2.40 was just introduced, and now there are five new minor versions. Below we’ll walk you through the most important bug fixes.

Vue throws error on strange single file component (SFC)

The code passed to the single-file component parser does not have