From 0369ddef589a12f7de0802f4da6c60b904e45b73 Mon Sep 17 00:00:00 2001 From: Weves Date: Thu, 16 May 2024 14:40:17 -0700 Subject: [PATCH] Fix document set editor refresh --- web/src/lib/hooks.ts | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/web/src/lib/hooks.ts b/web/src/lib/hooks.ts index 8d65f365cb4..27556b0676d 100644 --- a/web/src/lib/hooks.ts +++ b/web/src/lib/hooks.ts @@ -11,6 +11,7 @@ import { errorHandlingFetcher, fetcher } from "./fetcher"; import { useState } from "react"; import { DateRangePickerValue } from "@tremor/react"; import { SourceMetadata } from "./search/interfaces"; +import { EE_ENABLED } from "./constants"; const CREDENTIAL_URL = "/api/manage/admin/credential"; @@ -114,9 +115,25 @@ EE Only APIs const USER_GROUP_URL = "/api/manage/admin/user-group"; -export const useUserGroups = () => { +export const useUserGroups = (): { + data: UserGroup[] | undefined; + isLoading: boolean; + error: string; + refreshUserGroups: () => void; +} => { const swrResponse = useSWR(USER_GROUP_URL, errorHandlingFetcher); + if (!EE_ENABLED) { + return { + ...{ + data: [], + isLoading: false, + error: "", + }, + refreshUserGroups: () => {}, + }; + } + return { ...swrResponse, refreshUserGroups: () => mutate(USER_GROUP_URL),