-
Middleware in React Router โ
We landed our initial unstable implementation of middleware behind a future flag in 7.3.0. Since then, we’ve been iterating on the API/implementation and working closely with community members who adopted the unstable flag for alpha testing. We received a ton of valuable feedback from those folks that helped us move the API to an even better spot in the end.
We’re excited to finally stabilize these APIs in 7.9.0 behind the
future.v8_middleware
flag and can’t wait to see the interesting patterns folks come up with when using them. There are already a handful of useful middlewares available in remix-utils that are worth checking out!Providing data from a parent to a child:
// app/root.tsx const context = createContext<User>(); const userMiddleware: Route.MiddlewareFunction = ({ context }) => { let user = await getUser(request); context.set(userContext, user); // ๐ Provide data here }; export const middleware = [userMiddleware]; export async function loader({ context }) { return { user: context.get(userContext) }; // ๐ Access data here } // app/routes/_index.tsx export async function loader({ request }) { let user = context.get(userContext); // ๐ Access data here // ... }
Short-circuiting child loaders with a redirect:
// app/routes/_auth.tsx const requireUserMiddleware: Route.MiddlewareFunction = ({ context }) => { let user = await getUser(request); if (!user) { throw redirect("/login"); } // ... }; export const middleware = [requireUserMiddleware]; // app/routes/_auth.profile.tsx export async function loader({ request }) { // โ This code will never run if there's no logged-in user let data = await getUserData(request); return data; }
Via X
-
Secretive 3.0.0 โ
Secretive is an app by Max Goedjen for protecting and managing SSH keys with the Secure Enclave. I’ve been using it for years. Major release a couple days ago:
A huge update! UI Refresh for macOS 26 Tahoe and Liquid Glass, Post-Quantum Key Support, Enhanced Security, and lots more!
-
Gall’s Law โ
A complex system that works is invariably found to have evolved from a simple system that worked. A complex system designed from scratch never works and cannot be patched up to make it work. You have to start over with a working simple system.
John Gall, General Systemantics (1975), p. 71
Follow
Recent Knowledge Updates
Latest Blog Post
-
Starting at Apple
I will help small businesses succeed by building Apple Business Essentials โ a product which brings together device management, 24/7 Apple support, and iCloud storage into flexible subscription plans. More โ