[Update/bugfix] UI: Add disable/enable UI function when osc query is disabled.

Fix the error that the mic mute sync couldn't enable/disable.
This commit is contained in:
Sakamoto Shiina
2025-05-30 15:32:03 +09:00
parent ae38ed165d
commit 88cb4f72b5
16 changed files with 116 additions and 13 deletions

View File

@@ -60,10 +60,19 @@ export const createAtomWithHook = (initialValue, base_name, options) => {
};
const updateAtom = (payload, options = {}) => {
const { remain_state = false, set_state } = options;
const { remain_state = false, set_state, lock_state } = options;
setAtom((currentValue) => {
const new_state = set_state ?? (remain_state ? currentValue.state : "ok");
let new_state;
if (lock_state) {
new_state = set_state;
} else {
if (currentValue.lock_state) {
new_state = currentValue.state;
} else {
new_state = set_state ?? (remain_state ? currentValue.state : "ok");
}
}
const updated_data = typeof payload === "function"
? payload(currentValue)