Skip to content

V1.1.0 - Interrupting Cow

Compare
Choose a tag to compare
@ryansolid ryansolid released this 09 Aug 09:34
· 642 commits to main since this release

Expanding Solid's concurrency to include interruptible scheduling. Bug fixes around Types and around reactive execution order guarantees.

New Features

createUniqueId

A universal id generator that works across server/browser.

const id = createUniqueId();

Note on the server this only works under hydratable components

from

A simple helper to make it easier to interopt with external producers like RxJS observables or with Svelte Stores. This basically turns any subscribable (object with a subscribe method) into a Signal and manages subscription and disposal.

const signal = from(obsv$);

It can also take a custom producer function where the function is passed a setter function returns a unsubscribe function:

const clock = from(set => {
  const t = setInterval(() => set(1), 1000);
  return () => clearInterval(t);
});

Note: Signals created by from have equality checks turned off to interface better with external streams and sources.

enableScheduling (experimental)

By default, Solid's concurrent rendering/Transitions doesn't schedule work differently and just runs synchronously. Its purpose is to smooth out IO situations like Navigation. However, now you can opt into interruptible scheduling similar to React's behavior by calling this once at your program's entry. I've yet to see a realworld scenario where this makes a big difference but now we can do cool demos too and start testing it.

startTransition

Works like its counterpart in useTransition, this useful when you don't need pending state.

import { createSignal, startTransition } from "solid-js";

function App() {
  const [signal, setSignal] = createSignal("Howdy");
  function clickHandler(e) {
    startTransition(() => setSignal("Holla"));
  }

  /* ...stuff */
}