[bugfix] Fix settings data has not sync when init startup the software.(Mic Word Filter, VRC Mic Mute Sync)

This commit is contained in:
Sakamoto Shiina
2025-07-14 11:06:13 +09:00
parent 600faaf608
commit 5ca7d73be4
3 changed files with 26 additions and 2 deletions

View File

@@ -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,

View File

@@ -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,

View File

@@ -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];
})
);