Skip to content

v0.16.0

Compare
Choose a tag to compare
@github-actions github-actions released this 17 Dec 16:11
· 2869 commits to main since this release
91ad272

Introduces several deprecations in aim to simplify the lifecycle model and prepare Qwik for the future and stable release.

useTask$()

The deprecations include useMount$(), useWatch$(), useServerMount() and useClientMount$(), all of them now become useTask$()!

  • useMount$() -> useTask$()
  • useWatch$() -> useTask$()
  • useServerMount$() -> useTask$() + isServer
  • useClientMount$() -> useTask$() + isBrowser

You might be surprised, how all of them can be replaced with useTask$()?

Actually, useWatch$() already behaved like useMount$() when no track was used.

Please look at the updated lifecycle docs:
https://qwik.builder.io/docs/components/lifecycle/

Old code:

import { useMount$, useWatch$ } from '@builder.io/qwik';

export function MyComponent() {
  const signal = useSignal(0);
  useMount$(() => {
    console.log('mount');
  });
  useWatch$(({track}) => {
    track(signal)
    console.log('watch');
  });
  useServerMount$(() => {
    console.log('server mount');
  });
  useClientMount$(() => {
    console.log('client mount');
  });
}

New code:

import { useTask$ } from '@builder.io/qwik';
import { isServer, isBrowser } from '@builder.io/qwik/build';

export function MyComponent() {
  const signal = useSignal(0);
  useTask$(() => {
    console.log('mount');
  });
  useTask$(({track}) => {
    track(signal);
    console.log('watch');
  });
  useTask$(() => {
    if (isServer) {
      console.log('server mount');
    }
  });
  useTask$(() => {
    if (isBrowser) {
      console.log('client mount');
    }
  });
}

Deprecating node-fetch in favor of undici

Future versions of node will include fetch() natively. This version is based on undici.

In order to prepare for a future where we dont need a polifyll, we are deprecating node-fetch in favor of undici.

Vite 4

We are updating Qwik to Vite 4!! Read about the announcement!

QwikCity!

Soon we will release 0.1.0 of QwikCity features a brand new API that will drastically simplify how you build your apps. It's called Server Functions and it's gonna be awesome!

Coming soon!

What's Changed

New Contributors

Full Changelog: v0.15.2...v0.16.0