chore(ui): lint

This commit is contained in:
psychedelicious 2024-08-23 18:53:11 +10:00
parent 9f94c5a8bd
commit 45bd85c039
7 changed files with 25 additions and 28 deletions

View File

@ -1,4 +1,4 @@
import { createDraftSafeSelectorCreator, createSelector, createSelectorCreator, lruMemoize } from '@reduxjs/toolkit';
import { createDraftSafeSelectorCreator, createSelectorCreator, lruMemoize } from '@reduxjs/toolkit';
import type { GetSelectorsOptions } from '@reduxjs/toolkit/dist/entities/state_selectors';
import type { RootState } from 'app/store/store';
import { isEqual } from 'lodash-es';
@ -21,5 +21,4 @@ export const getSelectorsOptions: GetSelectorsOptions = {
}),
};
export const createAppSelector = createSelector.withTypes<RootState>();
export const createMemoizedAppSelector = createMemoizedSelector.withTypes<RootState>();

View File

@ -66,11 +66,6 @@ export const setScopes = (scopes: InteractionScope[]) => {
log.trace(`Set scopes: ${formatScopes($activeScopes.get())}`);
};
export const clearScopes = () => {
$activeScopes.set(new Set());
log.trace(`Cleared scopes`);
};
export const useScopeOnFocus = (scope: InteractionScope, ref: RefObject<HTMLElement>) => {
useEffect(() => {
const element = ref.current;

View File

@ -35,13 +35,12 @@ export const EntityLayerAdapterGate = memo(({ children }: PropsWithChildren) =>
EntityLayerAdapterGate.displayName = 'EntityLayerAdapterGate';
/** @knipignore */
export const useEntityLayerAdapter = (): CanvasLayerAdapter => {
const adapter = useContext(EntityAdapterContext);
assert(adapter, 'useEntityLayerAdapter must be used within a EntityLayerAdapterGate');
assert(adapter.type === 'layer_adapter', 'useEntityLayerAdapter must be used with a layer adapter');
return adapter;
};
// export const useEntityLayerAdapter = (): CanvasLayerAdapter => {
// const adapter = useContext(EntityAdapterContext);
// assert(adapter, 'useEntityLayerAdapter must be used within a EntityLayerAdapterGate');
// assert(adapter.type === 'layer_adapter', 'useEntityLayerAdapter must be used with a layer adapter');
// return adapter;
// };
export const EntityMaskAdapterGate = memo(({ children }: PropsWithChildren) => {
const canvasManager = useCanvasManager();
@ -69,13 +68,12 @@ export const EntityMaskAdapterGate = memo(({ children }: PropsWithChildren) => {
EntityMaskAdapterGate.displayName = 'EntityMaskAdapterGate';
/** @knipignore */
export const useEntityMaskAdapter = (): CanvasMaskAdapter => {
const adapter = useContext(EntityAdapterContext);
assert(adapter, 'useEntityMaskAdapter must be used within a CanvasMaskAdapterGate');
assert(adapter.type === 'mask_adapter', 'useEntityMaskAdapter must be used with a mask adapter');
return adapter;
};
// export const useEntityMaskAdapter = (): CanvasMaskAdapter => {
// const adapter = useContext(EntityAdapterContext);
// assert(adapter, 'useEntityMaskAdapter must be used within a CanvasMaskAdapterGate');
// assert(adapter.type === 'mask_adapter', 'useEntityMaskAdapter must be used with a mask adapter');
// return adapter;
// };
export const useEntityAdapter = (): CanvasLayerAdapter | CanvasMaskAdapter => {
const adapter = useContext(EntityAdapterContext);

View File

@ -26,9 +26,9 @@ export const MetadataControlNets = ({ metadata }: Props) => {
return (
<>
{controlNets.map((controlNet) => (
{controlNets.map((controlNet, i) => (
<MetadataViewControlNet
key={controlNet.id}
key={`${controlNet.model.key}-${i}`}
label={label}
controlNet={controlNet}
handlers={handlers.controlNets}

View File

@ -26,8 +26,13 @@ export const MetadataIPAdapters = ({ metadata }: Props) => {
return (
<>
{ipAdapters.map((ipAdapter) => (
<MetadataViewIPAdapter key={ipAdapter.id} label={label} ipAdapter={ipAdapter} handlers={handlers.ipAdapters} />
{ipAdapters.map((ipAdapter, i) => (
<MetadataViewIPAdapter
key={`${ipAdapter.model.key}-${i}`}
label={label}
ipAdapter={ipAdapter}
handlers={handlers.ipAdapters}
/>
))}
</>
);

View File

@ -26,9 +26,9 @@ export const MetadataT2IAdapters = ({ metadata }: Props) => {
return (
<>
{t2iAdapters.map((t2iAdapter) => (
{t2iAdapters.map((t2iAdapter, i) => (
<MetadataViewT2IAdapter
key={t2iAdapter.id}
key={`${t2iAdapter.model.key}-${i}`}
label={label}
t2iAdapter={t2iAdapter}
handlers={handlers.t2iAdapters}

View File

@ -1,4 +1,4 @@
import type { ControlNetConfig, IPAdapterConfig, T2IAdapterConfig } from 'features/controlAdapters/store/types';
import type { ControlNetConfig, IPAdapterConfig, T2IAdapterConfig } from 'features/controlLayers/store/types';
import type { O } from 'ts-toolbelt';
/**