fix: ensure correct handling of custom mini app updates and removals (#5922)

* fix: ensure correct handling of custom mini app updates and removals

* fix: update title for custom mini app to be more concise in localization files

---------

Co-authored-by: George Zhao <georgezhao@SKJLAB>
This commit is contained in:
George Zhao 2025-05-12 20:58:35 +08:00 committed by kangfenmao
parent 6314b391db
commit d456b3d4ed
4 changed files with 8 additions and 6 deletions

View File

@ -1148,7 +1148,7 @@
"miniapps": {
"title": "Mini Apps Settings",
"custom": {
"title": "Custom Mini App",
"title": "Custom",
"edit_title": "Edit Custom Mini App",
"save_success": "Custom mini app saved successfully.",
"save_error": "Failed to save custom mini app.",

View File

@ -1154,7 +1154,7 @@
"title": "在浏览器中打开新窗口链接"
},
"custom": {
"title": "自定义小程序",
"title": "自定义",
"edit_title": "编辑自定义小程序",
"save_success": "自定义小程序保存成功。",
"save_error": "自定义小程序保存失败。",

View File

@ -1156,7 +1156,7 @@
"custom": {
"duplicate_ids": "發現重複的ID: {{ids}}",
"conflicting_ids": "與預設應用ID衝突: {{ids}}",
"title": "自定義小程序",
"title": "自定義",
"edit_title": "編輯自定義小程序",
"save_success": "自定義小程序保存成功。",
"save_error": "自定義小程序保存失敗。",

View File

@ -53,7 +53,7 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
return
}
const newApp = {
const newApp: MinAppType = {
id: values.id,
name: values.name,
url: values.url,
@ -70,7 +70,7 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
// 重新加载应用列表
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
updateDefaultMinApps(reloadedApps)
updateMinapps(reloadedApps)
updateMinapps([...minapps, newApp])
} catch (error) {
message.error(t('settings.miniapps.custom.save_error'))
console.error('Failed to save custom mini app:', error)
@ -143,7 +143,9 @@ const App: FC<Props> = ({ app, onClick, size = 60, isLast }) => {
message.success(t('settings.miniapps.custom.remove_success'))
const reloadedApps = [...ORIGIN_DEFAULT_MIN_APPS, ...(await loadCustomMiniApp())]
updateDefaultMinApps(reloadedApps)
updateMinapps(reloadedApps)
updateMinapps(minapps.filter((item) => item.id !== app.id))
updatePinnedMinapps(pinned.filter((item) => item.id !== app.id))
updateDisabledMinapps(disabled.filter((item) => item.id !== app.id))
} catch (error) {
message.error(t('settings.miniapps.custom.remove_error'))
console.error('Failed to remove custom mini app:', error)