mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
chore(ui): lint
This commit is contained in:
@@ -14,6 +14,7 @@ const config: KnipConfig = {
|
||||
'src/features/controlLayers/konva/util.ts',
|
||||
// Will be using this
|
||||
'src/common/hooks/useAsyncState.ts',
|
||||
'src/app/store/use-debounced-app-selector.ts',
|
||||
],
|
||||
ignoreBinaries: ['only-allow'],
|
||||
paths: {
|
||||
|
||||
@@ -18,5 +18,3 @@ export const getSelectorsOptions = {
|
||||
argsMemoize: lruMemoize,
|
||||
}),
|
||||
};
|
||||
|
||||
export const createLruSelector = createSelectorCreator(lruMemoize);
|
||||
|
||||
@@ -15,8 +15,6 @@ import { memo } from 'react';
|
||||
import { InputFieldEditModeNodes } from './fields/InputFieldEditModeNodes';
|
||||
import InvocationNodeFooter from './InvocationNodeFooter';
|
||||
import InvocationNodeHeader from './InvocationNodeHeader';
|
||||
import { useInvocationNodeContext } from './context';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
|
||||
type Props = {
|
||||
nodeId: string;
|
||||
@@ -39,9 +37,7 @@ const sx: SystemStyleObject = {
|
||||
};
|
||||
|
||||
const InvocationNode = ({ nodeId, isOpen }: Props) => {
|
||||
const ctx = useInvocationNodeContext();
|
||||
const withFooter = useWithFooter();
|
||||
const needsUpdate = useAppSelector(ctx.selectNodeNeedsUpdate);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Flex, Icon, Text, Tooltip } from '@invoke-ai/ui-library';
|
||||
import { compare } from 'compare-versions';
|
||||
import { useNodeNeedsUpdate } from 'features/nodes/hooks/useNodeNeedsUpdate';
|
||||
import { useInvocationNodeNotes } from 'features/nodes/hooks/useNodeNotes';
|
||||
import { useNodeTemplateOrThrow } from 'features/nodes/hooks/useNodeTemplateOrThrow';
|
||||
import { useNodeUserTitleSafe } from 'features/nodes/hooks/useNodeUserTitleSafe';
|
||||
|
||||
@@ -9,8 +9,8 @@ import { selectNodes } from 'features/nodes/store/selectors';
|
||||
import type { InvocationNodeData } from 'features/nodes/types/invocation';
|
||||
import { memo, useMemo } from 'react';
|
||||
|
||||
import InvocationNodeUnknownFallback from './InvocationNodeUnknownFallback';
|
||||
import { InvocationNodeContextProvider } from './context';
|
||||
import InvocationNodeUnknownFallback from './InvocationNodeUnknownFallback';
|
||||
|
||||
const InvocationNodeWrapper = (props: NodeProps<Node<InvocationNodeData>>) => {
|
||||
const { data, selected } = props;
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import type { ChakraProps, SystemStyleObject } from '@invoke-ai/ui-library';
|
||||
import { Box, useGlobalMenuClose } from '@invoke-ai/ui-library';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import {
|
||||
InvocationNodeContextProvider,
|
||||
useInvocationNodeContext,
|
||||
} from 'features/nodes/components/flow/nodes/Invocation/context';
|
||||
import { useInvocationNodeContext } from 'features/nodes/components/flow/nodes/Invocation/context';
|
||||
import { useIsWorkflowEditorLocked } from 'features/nodes/hooks/useIsWorkflowEditorLocked';
|
||||
import { useMouseOverFormField, useMouseOverNode } from 'features/nodes/hooks/useMouseOverNode';
|
||||
import { useNodeExecutionState } from 'features/nodes/hooks/useNodeExecutionState';
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { useInvocationNodeContext } from 'features/nodes/components/flow/nodes/Invocation/context';
|
||||
import type { InvocationNodeData } from 'features/nodes/types/invocation';
|
||||
|
||||
export const useNodeData = (): InvocationNodeData => {
|
||||
const ctx = useInvocationNodeContext();
|
||||
return useAppSelector(ctx.selectNodeDataOrThrow);
|
||||
};
|
||||
@@ -16,36 +16,17 @@ export const selectNode = (nodesSlice: NodesState, nodeId: string): AnyNode => {
|
||||
return node;
|
||||
};
|
||||
|
||||
export const selectInvocationNode = (nodesSlice: NodesState, nodeId: string): InvocationNode => {
|
||||
const selectInvocationNode = (nodesSlice: NodesState, nodeId: string): InvocationNode => {
|
||||
const node = nodesSlice.nodes.find((node) => node.id === nodeId);
|
||||
assert(isInvocationNode(node), `Node ${nodeId} is not an invocation node`);
|
||||
return node;
|
||||
};
|
||||
|
||||
export const selectInvocationNodeSafe = (nodesSlice: NodesState, nodeId: string): InvocationNode | undefined => {
|
||||
const node = nodesSlice.nodes.find((node) => node.id === nodeId);
|
||||
if (!isInvocationNode(node)) {
|
||||
return undefined;
|
||||
}
|
||||
return node;
|
||||
};
|
||||
|
||||
export const selectNodeData = (nodesSlice: NodesState, nodeId: string): InvocationNodeData => {
|
||||
const node = selectInvocationNode(nodesSlice, nodeId);
|
||||
return node.data;
|
||||
};
|
||||
|
||||
export const selectFieldInputInstance = (
|
||||
nodesSlice: NodesState,
|
||||
nodeId: string,
|
||||
fieldName: string
|
||||
): FieldInputInstance => {
|
||||
const data = selectNodeData(nodesSlice, nodeId);
|
||||
const field = data.inputs[fieldName];
|
||||
assert(field !== undefined, `Field ${fieldName} not found in node ${nodeId}`);
|
||||
return field;
|
||||
};
|
||||
|
||||
export const selectFieldInputInstanceSafe = (
|
||||
nodesSlice: NodesState,
|
||||
nodeId: string,
|
||||
|
||||
@@ -172,7 +172,7 @@ const validateNumberFieldValue: FieldValidationFunc<
|
||||
return reasons;
|
||||
};
|
||||
|
||||
export type NodeError = {
|
||||
type NodeError = {
|
||||
type: 'node-error';
|
||||
nodeId: string;
|
||||
issue: string;
|
||||
@@ -205,7 +205,7 @@ const getIssuesToFieldErrorsMapFunc =
|
||||
issue,
|
||||
});
|
||||
|
||||
export const getFieldErrors = (
|
||||
const getFieldErrors = (
|
||||
node: InvocationNode,
|
||||
nodeTemplate: InvocationTemplate,
|
||||
field: FieldInputInstance,
|
||||
@@ -291,7 +291,7 @@ export const getInvocationNodeErrors = (
|
||||
|
||||
export const $nodeErrors = map<Record<string, (NodeError | FieldError)[]>>({});
|
||||
|
||||
export const syncNodeErrors = (nodesState: NodesState, templates: Templates) => {
|
||||
const syncNodeErrors = (nodesState: NodesState, templates: Templates) => {
|
||||
for (const node of nodesState.nodes) {
|
||||
const errors: (NodeError | FieldError)[] = [];
|
||||
if (!isInvocationNode(node)) {
|
||||
|
||||
Reference in New Issue
Block a user