feat(ui): rerender mitigation sweep

This commit is contained in:
psychedelicious
2023-04-27 17:30:21 +10:00
parent 5d8728c7ef
commit ca1cc0e2c2
16 changed files with 98 additions and 138 deletions

View File

@@ -1,5 +1,6 @@
import { Flex, Image, Spinner } from '@chakra-ui/react';
import InvokeAILogoImage from 'assets/images/logo.png';
import { memo } from 'react';
// This component loads before the theme so we cannot use theme tokens here
@@ -29,4 +30,4 @@ const Loading = () => {
);
};
export default Loading;
export default memo(Loading);

View File

@@ -1,5 +1,6 @@
import { RootState } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import { useCallback } from 'react';
import { OpenAPI } from 'services/api';
export const getUrlAlt = (url: string, shouldTransformUrls: boolean) => {
@@ -15,14 +16,19 @@ export const useGetUrl = () => {
(state: RootState) => state.config.shouldTransformUrls
);
return {
shouldTransformUrls,
getUrl: (url?: string) => {
const getUrl = useCallback(
(url?: string) => {
if (OpenAPI.BASE && shouldTransformUrls) {
return [OpenAPI.BASE, url].join('/');
}
return url;
},
[shouldTransformUrls]
);
return {
shouldTransformUrls,
getUrl,
};
};