Skip to content

v0.6.0 - Take Flight

Compare
Choose a tag to compare
@ryansolid ryansolid released this 27 Feb 23:15
· 197 commits to main since this release

Listening carefully to the feedback and reflecting on the second month of beta 2 we have prepared this release which improves on a lot of the usability around Start itself. This is less about features and more about stabilization but I'm excited that one of the coolest features we've showed off in a while was developed in the process: Single Flight Mutations.

Single Flight Mutations

This feature is really a combined Start + Solid Router feature but it showcases off the power of server function protocol. Inspired by React Server Component's ability to send back the next page in the same request with their server actions, we have added the ability to instead send back the data for the next page(or refresh of the same page's data). And not just send it back in a blocking way but to stream it back as it is available.

So you can picture the classic listing page + details page setup. You can in an action update a details page and have it redirect back to the listings page. We can now do that in one request. The item will be saved and return a redirect, at which point it starts sending back the request however the body will contain the data for the next page streamed as it completes. Suspense will allow the browser to start redirecting before all the data has returned and each cache function resolve as its data comes in.

Try the Notes and TodoMVC examples to see this in action.

The best part is this requires no new API. No required code change on your part. Can still use all the features like optimistic updates etc... And it supports granular revalidation. While by default we will revalidate all the data on the next page, you can still use our revalidate options in our router helpers (reload, redirect, json) select only certain cache keys and we will honor that. We diff the knowledge of which cache keys are already available on the page so that while we won't fetch any data that isn't in the keys from existing cache, we will still fetch new data for the new page sections (if it is a redirect).

This works with SSR on or off so it is available to any project that supports Server functions.

Vite 5

v0.6.0 adds support for Vite 5. I admit this took us a while but we were working on a whole new build system with Vinxi. @nksaraf has done amazing work here and continues to push the envelope. Also thanks to @birkskyum for getting this rolling and testing the integration until it was ready to go.

We look forward to an even quicker dev experience and all the other goodies that come with the update.

vite.config -> app.config

A lot of people expressed confusion over the difference in options and settings and we decided you were right. In so we have stopped using vite.config.ts and instead opt for an app.config.ts. We have also updated the settings to be clearer. SolidStart's own settings are now top level and you will find the vite settings under a vite property. This allows more flexibility as Vite can be configured now per Vinxi router.

import { defineConfig } from "@solidjs/start/config";

export default defineConfig({
  ssr: false,
  server: {
    preset: "netlify"
  },
  vite(options) {
    if (options.router === "server") ....
    return { plugins: [] }
  }
});

We've added the ability to disable the dev overlay in dev so you can see the errors the way your users would in prod. We've also moved the ssr mode settings from the config to the runtime to handle more dynamic needs.

Handler Config as a Function

We've expanded the capability of handler config so that we can do my dynamic things at runtime. Things like switch between render modes. This way we can turn off streaming for bots etc.. Or applying a nonce based on the middleware configuration.

import { createHandler, StartServer } from "@solidjs/start/server";

export default createHandler(() => (
  <StartServer document={/*...*/} />
), (event) => {
  return { nonce: event.locals.nonce, mode: event.locals.isBot ? "async" : "stream"}
};

A Long and Steady Road

We've been at this for a while but things are consolidating nicely. We are now feature complete for SolidStart 1.0 so it is time to fix bugs and get docs going. If we based on the feedback of these recent changes I hope to have an RC out in the coming weeks. Thank you all for your patience and your support.

Best,
@ryansolid