Skip to content

Releases: forge42dev/remix-client-cache

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