Skip to content

v2.0.0

Compare
Choose a tag to compare
@Fuiste Fuiste released this 12 Jul 20:39
· 29 commits to main since this release

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 Errorables, 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.