mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-06-06 21:19:54 +02:00
Remove mildly annoying groups fetch (#2733)
* remove mildly annoying groups fetch * ensure in client component
This commit is contained in:
parent
f83e6806b6
commit
10f221cd37
@ -1,3 +1,4 @@
|
||||
"use client";
|
||||
import {
|
||||
ConnectorIndexingStatus,
|
||||
DocumentBoostStatus,
|
||||
@ -6,14 +7,14 @@ import {
|
||||
} from "@/lib/types";
|
||||
import useSWR, { mutate, useSWRConfig } from "swr";
|
||||
import { errorHandlingFetcher } from "./fetcher";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useContext, useEffect, useState } from "react";
|
||||
import { DateRangePickerValue } from "@tremor/react";
|
||||
import { SourceMetadata } from "./search/interfaces";
|
||||
import { destructureValue } from "./llm/utils";
|
||||
import { ChatSession } from "@/app/chat/interfaces";
|
||||
import { UsersResponse } from "./users/interfaces";
|
||||
import { usePaidEnterpriseFeaturesEnabled } from "@/components/settings/usePaidEnterpriseFeaturesEnabled";
|
||||
import { Credential } from "./connectors/credentials";
|
||||
import { SettingsContext } from "@/components/settings/SettingsProvider";
|
||||
|
||||
const CREDENTIAL_URL = "/api/manage/admin/credential";
|
||||
|
||||
@ -220,8 +221,14 @@ export const useUserGroups = (): {
|
||||
error: string;
|
||||
refreshUserGroups: () => void;
|
||||
} => {
|
||||
const swrResponse = useSWR<UserGroup[]>(USER_GROUP_URL, errorHandlingFetcher);
|
||||
const isPaidEnterpriseFeaturesEnabled = usePaidEnterpriseFeaturesEnabled();
|
||||
const combinedSettings = useContext(SettingsContext);
|
||||
const isPaidEnterpriseFeaturesEnabled =
|
||||
combinedSettings && combinedSettings.enterpriseSettings !== null;
|
||||
|
||||
const swrResponse = useSWR<UserGroup[]>(
|
||||
isPaidEnterpriseFeaturesEnabled ? USER_GROUP_URL : null,
|
||||
errorHandlingFetcher
|
||||
);
|
||||
|
||||
if (!isPaidEnterpriseFeaturesEnabled) {
|
||||
return {
|
||||
|
Loading…
x
Reference in New Issue
Block a user