mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
only ever get cache status if feature is enabled
This commit is contained in:
parent
f36b5990ed
commit
6a4c77e3b4
@ -1,4 +1,5 @@
|
|||||||
import { ButtonGroup } from '@invoke-ai/ui-library';
|
import { ButtonGroup } from '@invoke-ai/ui-library';
|
||||||
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
||||||
@ -10,7 +11,8 @@ import ToggleInvocationCacheButton from './ToggleInvocationCacheButton';
|
|||||||
|
|
||||||
const InvocationCacheStatus = () => {
|
const InvocationCacheStatus = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined);
|
const isCacheEnabled = useFeatureStatus('invocationCache').isFeatureEnabled;
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, { skip: isCacheEnabled });
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StatusStatGroup>
|
<StatusStatGroup>
|
||||||
|
@ -1,13 +1,15 @@
|
|||||||
import { Button } from '@invoke-ai/ui-library';
|
import { Button } from '@invoke-ai/ui-library';
|
||||||
import { useDisableInvocationCache } from 'features/queue/hooks/useDisableInvocationCache';
|
import { useDisableInvocationCache } from 'features/queue/hooks/useDisableInvocationCache';
|
||||||
import { useEnableInvocationCache } from 'features/queue/hooks/useEnableInvocationCache';
|
import { useEnableInvocationCache } from 'features/queue/hooks/useEnableInvocationCache';
|
||||||
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
import { useGetInvocationCacheStatusQuery } from 'services/api/endpoints/appInfo';
|
||||||
|
|
||||||
const ToggleInvocationCacheButton = () => {
|
const ToggleInvocationCacheButton = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery();
|
const isCacheEnabled = useFeatureStatus('invocationCache').isFeatureEnabled;
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, { skip: isCacheEnabled });
|
||||||
|
|
||||||
const {
|
const {
|
||||||
enableInvocationCache,
|
enableInvocationCache,
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { addToast } from 'features/system/store/systemSlice';
|
import { addToast } from 'features/system/store/systemSlice';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -7,7 +8,8 @@ import { useClearInvocationCacheMutation, useGetInvocationCacheStatusQuery } fro
|
|||||||
export const useClearInvocationCache = () => {
|
export const useClearInvocationCache = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery();
|
const isCacheEnabled = useFeatureStatus('invocationCache').isFeatureEnabled;
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, { skip: isCacheEnabled });
|
||||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||||
const [trigger, { isLoading }] = useClearInvocationCacheMutation({
|
const [trigger, { isLoading }] = useClearInvocationCacheMutation({
|
||||||
fixedCacheKey: 'clearInvocationCache',
|
fixedCacheKey: 'clearInvocationCache',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { addToast } from 'features/system/store/systemSlice';
|
import { addToast } from 'features/system/store/systemSlice';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -7,7 +8,8 @@ import { useDisableInvocationCacheMutation, useGetInvocationCacheStatusQuery } f
|
|||||||
export const useDisableInvocationCache = () => {
|
export const useDisableInvocationCache = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery();
|
const isCacheEnabled = useFeatureStatus('invocationCache').isFeatureEnabled;
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, { skip: isCacheEnabled });
|
||||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||||
const [trigger, { isLoading }] = useDisableInvocationCacheMutation({
|
const [trigger, { isLoading }] = useDisableInvocationCacheMutation({
|
||||||
fixedCacheKey: 'disableInvocationCache',
|
fixedCacheKey: 'disableInvocationCache',
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||||
|
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||||
import { addToast } from 'features/system/store/systemSlice';
|
import { addToast } from 'features/system/store/systemSlice';
|
||||||
import { useCallback, useMemo } from 'react';
|
import { useCallback, useMemo } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
@ -7,7 +8,8 @@ import { useEnableInvocationCacheMutation, useGetInvocationCacheStatusQuery } fr
|
|||||||
export const useEnableInvocationCache = () => {
|
export const useEnableInvocationCache = () => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const { data: cacheStatus } = useGetInvocationCacheStatusQuery();
|
const isCacheEnabled = useFeatureStatus('invocationCache').isFeatureEnabled;
|
||||||
|
const { data: cacheStatus } = useGetInvocationCacheStatusQuery(undefined, { skip: isCacheEnabled });
|
||||||
const isConnected = useAppSelector((s) => s.system.isConnected);
|
const isConnected = useAppSelector((s) => s.system.isConnected);
|
||||||
const [trigger, { isLoading }] = useEnableInvocationCacheMutation({
|
const [trigger, { isLoading }] = useEnableInvocationCacheMutation({
|
||||||
fixedCacheKey: 'enableInvocationCache',
|
fixedCacheKey: 'enableInvocationCache',
|
||||||
|
Loading…
Reference in New Issue
Block a user