From 5ca7d73be4df3ccd441cac3efb54d444e3504a11 Mon Sep 17 00:00:00 2001 From: Sakamoto Shiina <68018796+ShiinaSakamoto@users.noreply.github.com> Date: Mon, 14 Jul 2025 11:06:13 +0900 Subject: [PATCH] [bugfix] Fix settings data has not sync when init startup the software.(Mic Word Filter, VRC Mic Mute Sync) --- src-ui/logics/configs/others/useOthers.js | 5 +++++ .../configs/transcription/useTranscription.js | 16 ++++++++++++++++ src-ui/logics/useReceiveRoutes.js | 7 +++++-- 3 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src-ui/logics/configs/others/useOthers.js b/src-ui/logics/configs/others/useOthers.js index 62a14364..c8a417d6 100644 --- a/src-ui/logics/configs/others/useOthers.js +++ b/src-ui/logics/configs/others/useOthers.js @@ -107,6 +107,10 @@ export const useOthers = () => { } }; + const getSuccessEnableVrcMicMuteSync = (is_enabled) => { + updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled })); + }; + const setSuccessEnableVrcMicMuteSync = (is_enabled) => { updateEnableVrcMicMuteSync(old => ({ ...old.data, is_enabled: is_enabled })); showNotification_SaveSuccess(); @@ -199,6 +203,7 @@ export const useOthers = () => { // VRC Mic Mute Sync currentEnableVrcMicMuteSync, getEnableVrcMicMuteSync, + getSuccessEnableVrcMicMuteSync, toggleEnableVrcMicMuteSync, updateEnableVrcMicMuteSync, setSuccessEnableVrcMicMuteSync, diff --git a/src-ui/logics/configs/transcription/useTranscription.js b/src-ui/logics/configs/transcription/useTranscription.js index 0c4b8b2b..147aa9e6 100644 --- a/src-ui/logics/configs/transcription/useTranscription.js +++ b/src-ui/logics/configs/transcription/useTranscription.js @@ -97,6 +97,21 @@ export const useTranscription = () => { asyncStdoutToPython("/set/data/mic_word_filter", selected_mic_word_filter); }; + const getSuccessMicWordFilterList = (payload) => { + updateMicWordFilterList((prev_list) => { + const updated_list = [...prev_list.data]; + for (const value of payload) { + const existing_item = updated_list.find(item => item.value === value); + if (existing_item) { + existing_item.is_redoable = false; + } else { + updated_list.push({ value, is_redoable: false }); + } + } + return updated_list; + }); + }; + const setSuccessMicWordFilterList = (payload) => { updateMicWordFilterList((prev_list) => { const updated_list = [...prev_list.data]; @@ -283,6 +298,7 @@ export const useTranscription = () => { currentMicWordFilterList, getMicWordFilterList, + getSuccessMicWordFilterList, updateMicWordFilterList, setMicWordFilterList, setSuccessMicWordFilterList, diff --git a/src-ui/logics/useReceiveRoutes.js b/src-ui/logics/useReceiveRoutes.js index d83054d3..00c48a0b 100644 --- a/src-ui/logics/useReceiveRoutes.js +++ b/src-ui/logics/useReceiveRoutes.js @@ -194,7 +194,7 @@ export const ROUTE_META_LIST = [ { endpoint: "/get/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "updateMicMaxWords" }, { endpoint: "/set/data/mic_max_phrases", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicMaxWords" }, - { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "updateMicWordFilterList" }, + { endpoint: "/get/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "getSuccessMicWordFilterList" }, { endpoint: "/set/data/mic_word_filter", ns: configs, hook_name: "useTranscription", method_name: "setSuccessMicWordFilterList" }, // Transcription (Speaker) @@ -259,7 +259,7 @@ export const ROUTE_META_LIST = [ { endpoint: "/set/enable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, { endpoint: "/set/disable/logger_feature", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableAutoExportMessageLogs" }, - { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "updateEnableVrcMicMuteSync_FromBackend" }, + { endpoint: "/get/data/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "getSuccessEnableVrcMicMuteSync" }, { endpoint: "/set/enable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, { endpoint: "/set/disable/vrc_mic_mute_sync", ns: configs, hook_name: "useOthers", method_name: "setSuccessEnableVrcMicMuteSync" }, @@ -334,6 +334,9 @@ export const useReceiveRoutes = () => { ROUTE_META_LIST.map(({ endpoint, hook_name, method_name }) => { const result_obj = hook_results[hook_name] || {}; const fn = result_obj[method_name]; + if (fn === undefined && method_name !== null) { + console.error("Method not found.", {endpoint, hook_name, method_name, result_obj, fn}); + } return [endpoint, typeof fn === "function" ? fn : noop]; }) );