Skip to content

Search the guides, deployment pages, and API reference.

revalidate

import { revalidate } from "@pitlane/vite-plugin-remix/hmr";
function revalidate(app): void;

Applies a server update to the page: waits for initial hydration, then reloads the runtime's top frame, which refetches the current page through the app's fetch handler and reconciles it in place.

Call it from the browser entry's server:update listener:

if (import.meta.hot) {
import.meta.hot.on("server:update", () => revalidate(app));
}

It returns nothing on purpose. Vite handles HMR messages one at a time and waits for the promise a listener returns, so returning the pending reload would hold back the next update until it settled. A newer reload supersedes an older one, which Remix aborts. A failed reload is logged, and the next update tries again.

Parameters

app

AppRuntime

The runtime run() returned

Returns

void