Skip to content

Releases: forge-42/remix-client-cache

v3.0.0

27 Apr 11:10
Compare
Choose a tag to compare

CacheRoute

Wrapper function that wraps your component and provides the loader data to it. It takes two arguments, the component that is wrapped as the first one, and the config options as the second (like the adapter to use).

import { CacheRoute, createClientLoaderCache } from "remix-client-cache";
import type { Route } from "./+types/_index";

// Caches the loader data on the client
export const clientLoader = createClientLoaderCache<Route.ClientLoaderArgs>(); 

// Wraps the component and provides the loader data to it that gets hot swapped behind the scenes
export default CacheRoute(function Index({ loaderData }: Route.LoaderData) {
  const { user } = loaderData; 
  return (
    <div>
      {user.name} <hr /> {user.email}
      <hr />
      {user.username}
      <hr />
      {user.website} <hr />
      {user.description} 
    </div>
  );
})

Full Changelog: v2.1.0...v3.0.0

v2.1.0

21 Jan 13:17
4b4350e
Compare
Choose a tag to compare

What's Changed

Full Changelog: v2.0.1...v2.1.0

v2.0.1

21 Jan 13:09
Compare
Choose a tag to compare

React 19 support

Supports react 19 now
Full Changelog: v2.0.0...v2.0.1

v2.0.0 -react-router v7 support

09 Jan 17:49
6197d5b
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.1.0...v2.0.0

v1.1.0

17 Sep 15:26
Compare
Choose a tag to compare

decacheClientLoader

New utility passed to clientActions which allow you to clear the clientLoader cache on a successful action submission

import { json, type LoaderFunctionArgs } from "@remix-run/node";
import { ClientLoaderFunctionArgs } from "@remix-run/react"; 
import { decacheClientLoader, useCachedLoaderData } from "remix-client-cache";

export const loader = async ({ params }: LoaderFunctionArgs) => {
  const response = await fetch(
    `https://jsonplaceholder.typicode.com/users/${params.user}`
  );
  const user = await response.json();
  await new Promise((resolve) => setTimeout(resolve, 1000));
  return json({ user: { ...user, description: Math.random() } });
};
// The data is cached here
export const clientLoader = (args: ClientLoaderFunctionArgs) => cacheClientLoader;
clientLoader.hydrate = true;
// It is de-cached after a successful action submission via the clientAction export
export const clientAction = decacheClientLoader;

What's Changed

New Contributors

Full Changelog: v1.0.0...v1.1.0

v1.0.0

27 Jan 14:30
Compare
Choose a tag to compare

Initial release

Initial release of remix-client-cache

Full Changelog: https://github.com/Code-Forge-Net/remix-client-cache/commits/v1.0.0