From 223f0d085088980e06371736ab1b3028fe94b0ac Mon Sep 17 00:00:00 2001 From: t0ng7u Date: Wed, 13 Aug 2025 18:31:00 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(tokens):=20correct=20main=20?= =?UTF-8?q?Chat=20button=20navigation=20to=20prevent=20404?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The primary "Chat" button on the tokens table navigated to a 404 page because it passed incorrect arguments to onOpenLink (using a raw localStorage value instead of the parsed chat value). Changes: - Build chatsArray with an explicit `value` for each item. - Use the first item's `name` and `value` for the main button, matching the dropdown behavior. - Preserve existing error handling when no chats are configured. Impact: - Main "Chat" button now opens the correct link, consistent with the dropdown action. - No API/schema changes, no UI changes. File: - web/src/components/table/tokens/TokensColumnDefs.js Verification: - Manually verified primary button and dropdown both navigate correctly. - Linter passes with no issues. --- web/src/components/table/tokens/TokensColumnDefs.js | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/web/src/components/table/tokens/TokensColumnDefs.js b/web/src/components/table/tokens/TokensColumnDefs.js index 1d2ab9dd..443c59d3 100644 --- a/web/src/components/table/tokens/TokensColumnDefs.js +++ b/web/src/components/table/tokens/TokensColumnDefs.js @@ -305,6 +305,7 @@ const renderOperations = (text, record, onOpenLink, setEditingToken, setShowEdit node: 'item', key: i, name, + value: item[name], onClick: () => onOpenLink(name, item[name], record), }); } @@ -326,11 +327,8 @@ const renderOperations = (text, record, onOpenLink, setEditingToken, setShowEdit if (chatsArray.length === 0) { showError(t('请联系管理员配置聊天链接')); } else { - onOpenLink( - 'default', - chatsArray[0].name ? (parsed => parsed)(localStorage.getItem('chats')) : '', - record, - ); + const first = chatsArray[0]; + onOpenLink(first.name, first.value, record); } }} >