fix(ui): layer is selected when added

This commit is contained in:
psychedelicious 2024-06-17 11:59:07 +10:00
parent 21e814d766
commit aeb0a45eb6
4 changed files with 14 additions and 3 deletions

View File

@ -44,13 +44,16 @@ export const controlAdaptersReducers = {
processorPendingBatchId: null, processorPendingBatchId: null,
...config, ...config,
}); });
state.selectedEntityIdentifier = { type: 'control_adapter', id };
}, },
prepare: (config: ControlNetConfig | T2IAdapterConfig) => ({ prepare: (config: ControlNetConfig | T2IAdapterConfig) => ({
payload: { id: uuidv4(), config }, payload: { id: uuidv4(), config },
}), }),
}, },
caRecalled: (state, action: PayloadAction<{ data: ControlAdapterData }>) => { caRecalled: (state, action: PayloadAction<{ data: ControlAdapterData }>) => {
state.controlAdapters.push(action.payload.data); const { data } = action.payload;
state.controlAdapters.push(data);
state.selectedEntityIdentifier = { type: 'control_adapter', id: data.id };
}, },
caIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => { caIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => {
const { id } = action.payload; const { id } = action.payload;

View File

@ -25,11 +25,14 @@ export const ipAdaptersReducers = {
...config, ...config,
}; };
state.ipAdapters.push(layer); state.ipAdapters.push(layer);
state.selectedEntityIdentifier = { type: 'ip_adapter', id };
}, },
prepare: (config: IPAdapterConfig) => ({ payload: { id: uuidv4(), config } }), prepare: (config: IPAdapterConfig) => ({ payload: { id: uuidv4(), config } }),
}, },
ipaRecalled: (state, action: PayloadAction<{ data: IPAdapterData }>) => { ipaRecalled: (state, action: PayloadAction<{ data: IPAdapterData }>) => {
state.ipAdapters.push(action.payload.data); const { data } = action.payload;
state.ipAdapters.push(data);
state.selectedEntityIdentifier = { type: 'ip_adapter', id: data.id };
}, },
ipaIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => { ipaIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => {
const { id } = action.payload; const { id } = action.payload;

View File

@ -38,11 +38,14 @@ export const layersReducers = {
x: 0, x: 0,
y: 0, y: 0,
}); });
state.selectedEntityIdentifier = { type: 'layer', id };
}, },
prepare: () => ({ payload: { id: uuidv4() } }), prepare: () => ({ payload: { id: uuidv4() } }),
}, },
layerRecalled: (state, action: PayloadAction<{ data: LayerData }>) => { layerRecalled: (state, action: PayloadAction<{ data: LayerData }>) => {
state.layers.push(action.payload.data); const { data } = action.payload;
state.layers.push(data);
state.selectedEntityIdentifier = { type: 'layer', id: data.id };
}, },
layerIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => { layerIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => {
const { id } = action.payload; const { id } = action.payload;

View File

@ -72,6 +72,7 @@ export const regionsReducers = {
imageCache: null, imageCache: null,
}; };
state.regions.push(rg); state.regions.push(rg);
state.selectedEntityIdentifier = { type: 'regional_guidance', id };
}, },
prepare: () => ({ payload: { id: uuidv4() } }), prepare: () => ({ payload: { id: uuidv4() } }),
}, },
@ -89,6 +90,7 @@ export const regionsReducers = {
rgRecalled: (state, action: PayloadAction<{ data: RegionalGuidanceData }>) => { rgRecalled: (state, action: PayloadAction<{ data: RegionalGuidanceData }>) => {
const { data } = action.payload; const { data } = action.payload;
state.regions.push(data); state.regions.push(data);
state.selectedEntityIdentifier = { type: 'regional_guidance', id: data.id };
}, },
rgIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => { rgIsEnabledToggled: (state, action: PayloadAction<{ id: string }>) => {
const { id } = action.payload; const { id } = action.payload;