mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
fix(canvas): add null checks for canvas manager and bbox selectors
- Fixed CanvasPasteModal null checks for canvasManager and getBbox() - Fixed CanvasHUDItemBbox null check for bbox selector - Fixed RegionalGuidanceEntityList null check for canvas selector These fixes resolve TypeScript null pointer errors in canvas components. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -37,7 +37,14 @@ export const CanvasPasteModal = memo(() => {
|
||||
|
||||
const getPosition = useCallback(
|
||||
(destination: 'canvas' | 'bbox') => {
|
||||
const { x, y } = canvasManager.stateApi.getBbox().rect;
|
||||
if (!canvasManager) {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
const bbox = canvasManager.stateApi.getBbox();
|
||||
if (!bbox) {
|
||||
return { x: 0, y: 0 };
|
||||
}
|
||||
const { x, y } = bbox.rect;
|
||||
if (destination === 'bbox') {
|
||||
return { x, y };
|
||||
}
|
||||
@@ -50,7 +57,7 @@ export const CanvasPasteModal = memo(() => {
|
||||
return { x, y };
|
||||
}
|
||||
},
|
||||
[canvasManager.compositor, canvasManager.stateApi]
|
||||
[canvasManager?.compositor, canvasManager?.stateApi]
|
||||
);
|
||||
|
||||
const handlePaste = useCallback(
|
||||
|
||||
@@ -5,7 +5,7 @@ import { selectBbox } from 'features/controlLayers/store/selectors';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const selectBboxRect = createSelector(selectBbox, (bbox) => bbox.rect);
|
||||
const selectBboxRect = createSelector(selectBbox, (bbox) => bbox?.rect || { width: 0, height: 0 });
|
||||
|
||||
export const CanvasHUDItemBbox = memo(() => {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@@ -8,6 +8,7 @@ import { getEntityIdentifier } from 'features/controlLayers/store/types';
|
||||
import { memo } from 'react';
|
||||
|
||||
const selectEntityIdentifiers = createMemoizedSelector(selectCanvasSlice, (canvas) => {
|
||||
if (!canvas) return [];
|
||||
return canvas.regionalGuidance.entities.map(getEntityIdentifier).toReversed();
|
||||
});
|
||||
const selectIsSelected = createSelector(selectSelectedEntityIdentifier, (selectedEntityIdentifier) => {
|
||||
|
||||
@@ -25,7 +25,11 @@ Started: 2025-09-02
|
||||
- ❌ Settings accordion property access errors
|
||||
|
||||
### Fixes Applied
|
||||
None yet.
|
||||
- ✅ **Import/Export Errors Fixed (2 commits)**
|
||||
- Added missing `rasterLayerConverted*` action exports to canvasInstanceSlice
|
||||
- Added missing bbox, entity, and drawing action exports
|
||||
- Fixed `canvasClearHistory` import in imageActions to come from canvasesSlice
|
||||
- Fixed `rgAdded` export name (was incorrectly exported as `regionalGuidanceAdded`)
|
||||
|
||||
## Next Steps
|
||||
1. Fix missing rasterLayer conversion actions in canvasInstanceSlice
|
||||
|
||||
Reference in New Issue
Block a user