-
Notifications
You must be signed in to change notification settings - Fork 159
美化 Galgame 模式切换并优化切换反馈 #1192
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
wehos
merged 6 commits into
Project-N-E-K-O:main
from
MomiJiSan:feat/galgame-mode-switch-beautify
May 6, 2026
+217
−15
Merged
美化 Galgame 模式切换并优化切换反馈 #1192
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
c364fae
改动:
MomiJiSan 0c8d9a9
现在点击模式后会同时乐观更新三件事:
MomiJiSan 8e03d52
改动在 N.E.K.O/plugin/plugins/galgame_plugin/static/main.js:3238:
MomiJiSan 2d371d2
fix(galgame): hard-disable mode switch when plugin unavailable + lift…
85d79be
fix(galgame): keep modeSelect synced with optimistic mode + handle pa…
8317cc7
fix(galgame): bump modeSaveRequestId after validation + gate all stal…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When
pendingModeSelectionis set,renderStatusrenders the UI summary/switch usingcurrentModebut the form control is still synchronized fromstatus.modeearlier in the function, so the visible mode and#modeSelectcan diverge during stale refreshes. In that window, any latersaveMode()call (for example from changing speed/push settings or autosave) will read the stale#modeSelectvalue and send the previous mode back togalgame_set_mode, unintentionally reverting the user's just-selected mode.Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in 85d79be — verified the race trace:
modeSelect.value = NEW,pendingModeSelection = NEW,settingsDirty = true,saveMode()派发settingsDirty = false; settingsSaveInFlight = false; await refreshAll(...)syncSettingsValue("modeSelect", STALE)不再被shouldPreserveSettingsControls()挡 →#modeSelect.value悄悄回到 STALEpendingModeSelection仍显示 NEW, 但 form control 已 stale → 下次 autosave (任何控件触发) 读到 stale modeSelect → 静默 revert修法:把
currentMode = pendingModeSelection || statusMode的计算前移到syncSettingsValue之前,syncSettingsValue("modeSelect", currentMode),让 form control 永远跟可见 UI / 乐观状态一致。这样即便上面的 race window 命中,sync 进 modeSelect 的也是 NEW(pending 还在)而不是 STALE。