From 0ccd7d8846a39a05a562306d76c3ee9a04118319 Mon Sep 17 00:00:00 2001 From: mishamyrt Date: Mon, 8 Jan 2024 01:45:17 +0300 Subject: [PATCH] fix: reload backlight colors on mode change --- frontend/src/entities/lights/model/store.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/frontend/src/entities/lights/model/store.ts b/frontend/src/entities/lights/model/store.ts index 400a253d..435de923 100644 --- a/frontend/src/entities/lights/model/store.ts +++ b/frontend/src/entities/lights/model/store.ts @@ -3,7 +3,7 @@ import { createEffect, createEvent, createStore, sample } from 'effector' import { interval } from 'patronum' import { createSequence } from '$shared/lib' -import { connected, disconnected } from '$shared/model' +import { connected, disconnected, modeSettingsChanged } from '$shared/model' import { getBacklightColors, setBacklightColor } from '../api/color' import { getModes } from '../api/mode' @@ -82,6 +82,10 @@ sample({ clock: connected, target: [getModesFx, getBacklightColorsFx] }) +sample({ + clock: modeSettingsChanged, + target: getBacklightColorsFx +}) modesStore.on(getModesFx.doneData, (_, modes) => modes) backlightColorsStore.on(getBacklightColorsFx.doneData, (_, colors) => colors)