SSR redirects
A redirect made during the server render did not go out as one.
A string-rendered route took it for a failed render and served the CSR fallback, so the browser got a 200, and the redirect happened only once the client router ran. A streamed route had already sent its 200. Solid's redirects never reached the server as redirects, and a Vue guard that sent the navigation elsewhere had the other page served under the requested URL.
Now each one goes out as a real 3xx with a Location header, in both render modes:
- React - React Router's
redirect(), thrown from a loader - Solid -
<Navigate>,navigate(), or aqueryreturningredirect() - Vue - a navigation guard returning another location, or a
Responsethrown from the loader - Svelte - a
Responsethrown from the loader
export const loader = () => {
throw new Response(null, {
status: 301,
headers: { Location: "/app/new" },
});
};A router resolves its path against the folder's base; a thrown Response carries its Location as is, so it includes the base. Solid Router and Vue guards always answer with a 302.
A thrown Response with no Location, or with a status that is not a redirect, gets a 500: Malformed redirect.
The not-found page can redirect too, and the redirect goes out in place of the 404.
Streamed routes fall back to CSR
A string-rendered route that fails on the server falls back to CSR: the client shell is served, and the page renders in the browser, where its own error boundaries handle the failure.
A streamed route did not. Its response started right away, so any failure left a broken document behind.
Now a streamed route is rendered up to its shell before the response starts. A failure there - a loader's failed fetch, a render that throws before the shell is ready - gets the same CSR fallback, and the same WARN: SSR failed, fallback to CSR in the log. So most SSR errors in stream mode now land where they land in string mode.
Past the shell, nothing changes. A component that throws while the page streams can only be reported, through the onError hook, and the page has to handle it itself.
Where the shell ends is the framework's call:
- React - loaders run before it, and it covers everything outside Suspense boundaries
- Vue - loaders run before it, and the render itself streams
- Solid renders lazily, so its queries run as the page streams, past the shell
#/ replaces @/
v0.7.2 brought #src/ and #lib/, while the project root stayed at @/. It moves to #/, so the three prefixes that reach across the project share one sign:
#/for the project root:#/db/models#src/for any source folder, by name:#src/front/types/user#lib/for any folder's derived code, by name:#lib/admin/core
~/ and _/ stay as they are: they resolve against the folder that imports them.
Upgrading
#/
Replace @/ with #/ in your imports, and in customTypesImport if it uses it:
import { db } from "@/db";
import { db } from "#/db";No package name starts with @/, so searching for "@/ and '@/ finds every one of them, and a plain replace is safe. The mapping itself lives in the generated tsconfig.json under var/lib/, which is written anew on the next start.
Redirects and streamed routes
Nothing to change. What redirected in the browser now redirects on the server as well, and a streamed route that fails before its shell now serves the CSR shell instead of a broken document.