Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
该 PR 旨在缓解离线皮肤设置中手动输入 CustomSkinLoader API(Blessing Skin 等)地址时,每输入一个字符就触发刷新并弹出“操作失败” toast 的问题,通过对刷新行为做延时与校验拦截来减少无效请求与提示。
Changes:
- 为 CSL API 输入触发的皮肤刷新增加 1 秒延时(debounce)。
- 在 CSL API 校验不通过时不触发刷新,从而避免输入过程中的失败 toast。
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+171
to
+176
| if (selectedType == Skin.Type.CUSTOM_SKIN_LOADER_API) { | ||
| if (!cslApiField.validate()) { | ||
| pauseTransition.stop(); | ||
| return; | ||
| } | ||
| pauseTransition.playFromStart(); |
Comment on lines
140
to
+179
| @@ -157,6 +161,23 @@ public OfflineAccountSkinPane(OfflineAccount account) { | |||
| result.getCape() != null ? result.getCape().getImage() : null); | |||
| } | |||
| }).start(); | |||
| }; | |||
|
|
|||
| pauseTransition.setOnFinished(e -> loadSkin.run()); | |||
|
|
|||
| skinBinding = FXUtils.observeWeak(() -> { | |||
| Skin.Type selectedType = skinItem.getSelectedData(); | |||
|
|
|||
| if (selectedType == Skin.Type.CUSTOM_SKIN_LOADER_API) { | |||
| if (!cslApiField.validate()) { | |||
| pauseTransition.stop(); | |||
| return; | |||
| } | |||
| pauseTransition.playFromStart(); | |||
| } else { | |||
| pauseTransition.stop(); | |||
| loadSkin.run(); | |||
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
目前如果手打 Blessing Skin 链接,打一个字就会刷新一次皮肤,就会弹一次 “操作失败” toast。
本 PR 通过添加 1 秒延时和校验不通过情况不刷新缓解了本问题。