mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-02-02 19:24:58 -05:00
chore(ui): lint
This commit is contained in:
@@ -1,24 +0,0 @@
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { selectCanvasSlice, selectEntity } from 'features/controlLayers/store/selectors';
|
||||
import { type CanvasEntityIdentifier, isDrawableEntity } from 'features/controlLayers/store/types';
|
||||
import { useMemo } from 'react';
|
||||
|
||||
export const useEntityObjectCount = (entityIdentifier: CanvasEntityIdentifier) => {
|
||||
const selectObjectCount = useMemo(
|
||||
() =>
|
||||
createSelector(selectCanvasSlice, (canvas) => {
|
||||
const entity = selectEntity(canvas, entityIdentifier);
|
||||
if (!entity) {
|
||||
return 0;
|
||||
} else if (isDrawableEntity(entity)) {
|
||||
return entity.objects.length;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}),
|
||||
[entityIdentifier]
|
||||
);
|
||||
const objectCount = useAppSelector(selectObjectCount);
|
||||
return objectCount;
|
||||
};
|
||||
Reference in New Issue
Block a user