tl;dr
const loader = strongLoader<BarResponse, FooResponse, RedirectResponse>(
async ({ request }, toComponent, toErrorBoundary) => {
const url = new URL(request.url);
if (url.pathname === "/bar") {
return toErrorBoundary(barResponse);
}
if (url.pathname === "/foo") {
return toComponent(fooResponse);
}
return redirectResponse;
}
);
const action = strongAction<BarResponse, FooResponse, RedirectResponse>(
async ({ request }, toComponent, toErrorBoundary) => {
const url = new URL(request.url);
if (url.pathname === "/bar") {
return toErrorBoundary(barResponse);
}
if (url.pathname === "/foo") {
return toComponent(fooResponse);
}
return redirectResponse;
}
);
What Changed
- New helper functions for
strongAction
and strongLoader
which inject the appropriate success & error callbacks
- No more
Errorable
s, we use fp-ts
Either
now.
- Added an
.nvmrc
, I originally ran into errors because I was using a different node runtime, causing the snapshots to render differently.