Skip to content

Commit

Permalink
feat: add cache option to renderTrpcPanel
Browse files Browse the repository at this point in the history
  • Loading branch information
pmenta committed Apr 3, 2023
1 parent 7b6ff1e commit 52dc2eb
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/trpc-panel/src/render.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {

export type RenderOptions = {
url: string;
cache?: boolean;
} & TrpcPanelExtraOptions;

const defaultParseRouterOptions: Partial<TrpcPanelExtraOptions> = {
Expand Down Expand Up @@ -62,7 +63,8 @@ let cache: {
};

export function renderTrpcPanel(router: Router<any>, options: RenderOptions) {
if (cache.val) return cache.val;
if (options.cache !== false && cache.val) return cache.val;

const bundleInjectionParams: InjectionParam[] = [
{
searchFor: routerReplaceSymbol,
Expand Down

0 comments on commit 52dc2eb

Please sign in to comment.