mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
fix(ui): do not use state => state
as an input selector
This is a no-no, whoops!
This commit is contained in:
@ -9,7 +9,7 @@ import ParamHrfToggle from './ParamHrfToggle';
|
||||
|
||||
export const HrfSettings = memo(() => {
|
||||
const isHRFFeatureEnabled = useFeatureStatus('hrf').isFeatureEnabled;
|
||||
const hrfEnabled = useAppSelector((state) => state.hrf.hrfEnabled);
|
||||
const hrfEnabled = useAppSelector((s) => s.hrf.hrfEnabled);
|
||||
|
||||
if (!isHRFFeatureEnabled) {
|
||||
return null;
|
||||
|
@ -18,7 +18,7 @@ const options: InvSelectOption[] = [
|
||||
const ParamHrfMethodSelect = () => {
|
||||
const dispatch = useAppDispatch();
|
||||
const { t } = useTranslation();
|
||||
const hrfMethod = useAppSelector((state) => state.hrf.hrfMethod);
|
||||
const hrfMethod = useAppSelector((s) => s.hrf.hrfMethod);
|
||||
|
||||
const onChange = useCallback<InvSelectOnChange>(
|
||||
(v) => {
|
||||
|
@ -1,27 +1,31 @@
|
||||
import { createMemoizedSelector } from 'app/store/createMemoizedSelector';
|
||||
import { stateSelector } from 'app/store/store';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { InvControl } from 'common/components/InvControl/InvControl';
|
||||
import { InvSlider } from 'common/components/InvSlider/InvSlider';
|
||||
import { setHrfStrength } from 'features/hrf/store/hrfSlice';
|
||||
import { selectHrfSlice, setHrfStrength } from 'features/hrf/store/hrfSlice';
|
||||
import { selectConfigSlice } from 'features/system/store/configSlice';
|
||||
import { memo, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
const selector = createMemoizedSelector([stateSelector], ({ hrf, config }) => {
|
||||
const { initial, min, sliderMax, inputMax, fineStep, coarseStep } =
|
||||
config.sd.hrfStrength;
|
||||
const { hrfStrength } = hrf;
|
||||
const selector = createMemoizedSelector(
|
||||
selectHrfSlice,
|
||||
selectConfigSlice,
|
||||
(hrf, config) => {
|
||||
const { initial, min, sliderMax, inputMax, fineStep, coarseStep } =
|
||||
config.sd.hrfStrength;
|
||||
const { hrfStrength } = hrf;
|
||||
|
||||
return {
|
||||
hrfStrength,
|
||||
initial,
|
||||
min,
|
||||
sliderMax,
|
||||
inputMax,
|
||||
step: coarseStep,
|
||||
fineStep,
|
||||
};
|
||||
});
|
||||
return {
|
||||
hrfStrength,
|
||||
initial,
|
||||
min,
|
||||
sliderMax,
|
||||
inputMax,
|
||||
step: coarseStep,
|
||||
fineStep,
|
||||
};
|
||||
}
|
||||
);
|
||||
|
||||
const ParamHrfStrength = () => {
|
||||
const { hrfStrength, initial, min, sliderMax, step, fineStep } =
|
||||
|
@ -1,5 +1,6 @@
|
||||
import type { PayloadAction } from '@reduxjs/toolkit';
|
||||
import { createSlice } from '@reduxjs/toolkit';
|
||||
import type { RootState } from 'app/store/store';
|
||||
import type {
|
||||
ParameterHRFMethod,
|
||||
ParameterStrength,
|
||||
@ -38,3 +39,5 @@ export const hrfSlice = createSlice({
|
||||
export const { setHrfEnabled, setHrfStrength, setHrfMethod } = hrfSlice.actions;
|
||||
|
||||
export default hrfSlice.reducer;
|
||||
|
||||
export const selectHrfSlice = (state: RootState) => state.hrf;
|
||||
|
Reference in New Issue
Block a user