Fix access-grant phone inputs losing focus after each keystroke.

Row keys included the phone value, so each character remounted the input; also sync draft from serialized grant content, not object identity.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
oliver 2026-09-05 16:50:42 +08:00
parent 9f97c44031
commit a0c49707a1
4 changed files with 11 additions and 9 deletions

View file

@ -571,7 +571,7 @@ var React24 = __toESM(require("react"), 1);
// package.json
var package_default = {
name: "dsh-im-ops",
version: "4.9.1-ops.4",
version: "4.9.1-ops.5",
description: "Ops fork of dsh-im (all channels kept). Based on @xmanrui/dsh-im@4.9.1 \u2014 access/session policies owned here.",
keywords: [
"deepseek-harness",
@ -12624,7 +12624,7 @@ function MemberRows({
h2("legend", null, title),
h2("ul", { className: "dim-accessUserList" }, members.map((member, index) => h2(
"li",
{ key: `${member.phone}-${index}`, className: "dim-accessUserRow" },
{ key: `member-${index}`, className: "dim-accessUserRow" },
h2(
"label",
{ className: "dim-accessField dim-accessUserId" },
@ -12683,7 +12683,7 @@ function AdminPhones({
const locked = lockedPhone && phone === lockedPhone;
return h2(
"li",
{ key: `${phone}-${index}`, className: "dim-accessUserRow" },
{ key: `admin-${index}`, className: "dim-accessUserRow" },
h2(
"label",
{ className: "dim-accessField dim-accessUserId" },
@ -12721,6 +12721,7 @@ function AccessGrantSettingsPage({ channel: channel4, account, rpcCall, onSaved
}
const ownerPhone = ownerPhoneFromAccount(account);
const initialGrant = normalizeAccessGrant(account?.accessGrant);
const initialKey = JSON.stringify(initialGrant);
const initialScope = normalizeGroupSessionScope(account?.groupSessionScope);
const [draft, setDraft] = React21.useState(() => cloneGrant(initialGrant, ownerPhone));
const [groupSessionScope, setGroupSessionScope] = React21.useState(initialScope);
@ -12730,7 +12731,7 @@ function AccessGrantSettingsPage({ channel: channel4, account, rpcCall, onSaved
React21.useEffect(() => {
setDraft(cloneGrant(normalizeAccessGrant(account?.accessGrant), ownerPhone));
setGroupSessionScope(normalizeGroupSessionScope(account?.groupSessionScope));
}, [account?.botId, account?.accessGrant, account?.groupSessionScope, ownerPhone]);
}, [account?.botId, initialKey, account?.groupSessionScope, ownerPhone]);
const contacts = draft.contacts ?? [];
const knownGroupJids = React21.useMemo(() => {
const set = new Set(Object.keys(draft.groups ?? {}));

File diff suppressed because one or more lines are too long