Skip to content

修复热键设置加载失败后永久 loading#351

Merged
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:fix/issue-316-hotkey-settings-error
May 8, 2026
Merged

修复热键设置加载失败后永久 loading#351
H-Chris233 merged 1 commit into
Open-Less:betafrom
H-Chris233:fix/issue-316-hotkey-settings-error

Conversation

@H-Chris233
Copy link
Copy Markdown
Collaborator

@H-Chris233 H-Chris233 commented May 8, 2026

User description

变更内容

  • 修复 HotkeySettingsContext.refresh() 任一 IPC 失败后 loading 永远不释放的问题。
  • 新增 context 级 errorrefresh() 使用 finally 保证退出 loading,并保留成功返回的 prefs/capability 半边状态。
  • 在翻译页展示“设置加载失败”错误和重试按钮,避免用户只看到永久加载态。
  • 补齐新增错误/重试文案的简中、繁中、英文、日文、韩文翻译。

验证

  • git diff --check
  • cd openless-all/app && npm run build
  • cd openless-all/app && cargo check --manifest-path src-tauri/Cargo.toml(仅既有 warning)

Closes #316


PR Type

Bug fix, Enhancement


Description

  • Fix permanent loading state on IPC failure using Promise.allSettled and finally

    • Always release loading even when one call rejects
    • Keep partially successful data (prefs or capability)
  • Add error state to HotkeySettingsContext for consumers

  • Show localized error alert and retry button in Translation page

  • Add retry and settingsLoadFailed keys to all five locales


Diagram Walkthrough

flowchart LR
  A["HotkeySettingsProvider.refresh()"] --> B["Promise.allSettled(getSettings, getHotkeyCapability)"]
  B -- "fulfilled" --> C["setPrefs / setCapability (partial success)"]
  B -- "rejected" --> D["setError(reason)"]
  C --> E["finally { setLoading(false) }"]
  D --> E
  E --> F["Context value updated with error"]
  F --> G["Translation page shows alert + retry button"]
Loading

File Walkthrough

Relevant files
Enhancement
5 files
en.ts
Add retry and load failure i18n keys                                         
+2/-0     
ja.ts
Add retry and load failure i18n keys                                         
+2/-0     
ko.ts
Add retry and load failure i18n keys                                         
+2/-0     
zh-CN.ts
Add retry and load failure i18n keys                                         
+2/-0     
zh-TW.ts
Add retry and load failure i18n keys                                         
+2/-0     
Bug fix
2 files
Translation.tsx
Display error alert and retry on load failure                       
+69/-2   
HotkeySettingsContext.tsx
Handle IPC failures with error state and finally                 
+34/-5   

Hotkey settings are a shared context for multiple pages, so one rejected IPC call must not leave the provider in a permanent loading state. The refresh path now records a localized recoverable error, keeps any successfully loaded half of the state, and always releases loading so consumers can render retry UI instead of staying blank.

Constraint: Issue Open-Less#316 requires local load failures to stay visible and non-fatal.
Rejected: Keep Promise.all with one catch | it would still discard partial success from the other IPC call.
Confidence: high
Scope-risk: narrow
Tested: git diff --check; npm run build; cargo check --manifest-path src-tauri/Cargo.toml
Not-tested: Manual Tauri UI session with a deliberately corrupted preferences.json.
Related: Open-Less#316
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 8, 2026

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

🎫 Ticket compliance analysis ✅

316 - PR Code Verified

Compliant requirements:

  • refresh() now always clears loading in finally.
  • Context value now exposes error.
  • Translation renders a localized failure message and retry button.
  • Localized retry and settingsLoadFailed strings were added.
  • Partial prefs/capability updates are preserved on mixed success/failure.

Requires further human verification:

  • Verify the new error/retry UI in Translation behaves correctly in the browser after failed, partial, and successful refreshes.
⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ No major issues detected

@H-Chris233 H-Chris233 merged commit 6c5eee6 into Open-Less:beta May 8, 2026
4 checks passed
@H-Chris233 H-Chris233 deleted the fix/issue-316-hotkey-settings-error branch May 9, 2026 04:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ui][bug] HotkeySettingsContext.refresh 失败 loading 永卡 — 所有依赖此 context 的页面陪葬

1 participant