mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
Fix rerenders on model select
This commit is contained in:
parent
dc5d696ed2
commit
3ea732365c
@ -7,23 +7,31 @@ import _ from 'lodash';
|
|||||||
import { ChangeEvent } from 'react';
|
import { ChangeEvent } from 'react';
|
||||||
import { systemSelector } from '../store/systemSelectors';
|
import { systemSelector } from '../store/systemSelectors';
|
||||||
|
|
||||||
const selector = createSelector([systemSelector], (system) => {
|
const selector = createSelector(
|
||||||
const { isProcessing, model_list } = system;
|
[systemSelector],
|
||||||
const models = _.map(model_list, (model, key) => key);
|
(system) => {
|
||||||
const activeModel = _.reduce(
|
const { isProcessing, model_list } = system;
|
||||||
model_list,
|
const models = _.map(model_list, (model, key) => key);
|
||||||
(acc, model, key) => {
|
const activeModel = _.reduce(
|
||||||
if (model.status === 'active') {
|
model_list,
|
||||||
acc = key;
|
(acc, model, key) => {
|
||||||
}
|
if (model.status === 'active') {
|
||||||
|
acc = key;
|
||||||
|
}
|
||||||
|
|
||||||
return acc;
|
return acc;
|
||||||
|
},
|
||||||
|
''
|
||||||
|
);
|
||||||
|
|
||||||
|
return { models, activeModel, isProcessing };
|
||||||
|
},
|
||||||
|
{
|
||||||
|
memoizeOptions: {
|
||||||
|
resultEqualityCheck: _.isEqual,
|
||||||
},
|
},
|
||||||
''
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return { models, activeModel, isProcessing };
|
|
||||||
});
|
|
||||||
|
|
||||||
const ModelSelect = () => {
|
const ModelSelect = () => {
|
||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user