fix: dropdown menu not opening on avatar click
React synthetic event stopPropagation doesn't stop native document listeners (React 17+ attaches to root, document listener is separate). The document click handler was closing the menu right after avatar opened it. Now it checks if the click target is inside the dropdown or on the avatar and skips closing.
This commit is contained in:
1 parent
89987c430c
commit
c8dcf32dd4
5 files changed
+38
-9
No files matched your search
@@ -12,7 +12,7 @@ export async function GET(req, { params }) {
|
||||
if (!UUID_RE.test(params.id)) return invalidId();
|
||||
try {
|
||||
const r = await pool.query(
|
||||
`SELECT p.*, u.username, u.avatar_url
|
||||
`SELECT p.*, u.username, u.avatar_url, u.signature
|
||||
FROM posts p
|
||||
JOIN users u ON p.user_id = u.id
|
||||
WHERE p.id = $1`,
|
||||
|
||||
@@ -10,7 +10,7 @@ export async function PUT(req, { params }) {
|
||||
}
|
||||
|
||||
const body = await req.json();
|
||||
const { username, bio, role } = body;
|
||||
const { username, bio, signature, role } = body;
|
||||
|
||||
// 改角色:仅管理员
|
||||
if (role !== undefined) {
|
||||
|
||||
Reference in new issue
Block a user