fix(open-webui): use current request-handler API to fix the build

The request handlers were written against an older caching API that dev has
since refactored ('TanStack Query as single source of truth'), breaking the
Turbopack build with a module-not-found on ./lib/cached-integration-request-handler.

- use createIntegrationRequestHandler from ./lib/integration-request-handler
- replace cacheDuration(dayjs)/queryKey with cacheTtlMs (ms)
- update the router consumers: getCachedOrUpdatedDataAsync -> getDataAsync and
  per-call invalidateAsync() -> handler-level invalidateCache()
This commit is contained in:
Thomas Camlong committed 2026-07-11 19:33:42 +02:00
1 parent 87f1f329da
commit 68ce7e73c0
2 files changed
+28 -36

No files matched your search

+11 -11
View File
@@ -170,7 +170,7 @@ export const openWebUiRouter = createTRPCRouter({
getModels: publicProcedure.concat(createOneIntegrationMiddleware("query", "openWebUi")).query(async ({ ctx }) => {
throwIfNotCreator(ctx.integration, ctx.session?.user.id);
const handler = openWebUiModelsRequestHandler.handler(ctx.integration, {});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -181,7 +181,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiChatsRequestHandler.handler(ctx.integration, {});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -193,7 +193,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiKnowledgeRequestHandler.handler(ctx.integration, {});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -202,7 +202,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiFilesRequestHandler.handler(ctx.integration, {});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -211,7 +211,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiNotesRequestHandler.handler(ctx.integration, {});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -221,7 +221,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx, input }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiNoteRequestHandler.handler(ctx.integration, { noteId: input.noteId });
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -233,7 +233,7 @@ export const openWebUiRouter = createTRPCRouter({
const handler = openWebUiKnowledgeFilesRequestHandler.handler(ctx.integration, {
knowledgeId: input.knowledgeId,
});
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -281,7 +281,7 @@ export const openWebUiRouter = createTRPCRouter({
.query(async ({ ctx, input }) => {
throwIfNotCreator(ctx.integration, ctx.session.user.id);
const handler = openWebUiChatRequestHandler.handler(ctx.integration, { chatId: input.chatId });
const { data } = await handler.getCachedOrUpdatedDataAsync({ forceUpdate: false });
const { data } = await handler.getDataAsync();
return data;
}),
@@ -297,7 +297,7 @@ export const openWebUiRouter = createTRPCRouter({
messages: input.messages,
meta: { tags: [homarrUserTag(ctx.session.user.id)] },
});
await openWebUiChatsRequestHandler.handler(ctx.integration, {}).invalidateAsync();
openWebUiChatsRequestHandler.invalidateCache();
return chat;
}),
@@ -311,8 +311,8 @@ export const openWebUiRouter = createTRPCRouter({
...input.chat,
meta: { tags: [homarrUserTag(ctx.session.user.id)] },
});
await openWebUiChatsRequestHandler.handler(ctx.integration, {}).invalidateAsync();
await openWebUiChatRequestHandler.handler(ctx.integration, { chatId: input.chatId }).invalidateAsync();
openWebUiChatsRequestHandler.invalidateCache();
openWebUiChatRequestHandler.invalidateCache();
return chat;
}),