fix: render uploaded attachments optimistically
This commit is contained in:
parent
61d4b7ac11
commit
59bc2b6000
File diff suppressed because one or more lines are too long
2
apps/api/internal/webassets/dist/index.html
vendored
2
apps/api/internal/webassets/dist/index.html
vendored
@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>ClickClack</title>
|
||||
<script type="module" crossorigin src="/assets/index-DmOFymbT.js"></script>
|
||||
<script type="module" crossorigin src="/assets/index-DbXhLgM5.js"></script>
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BOoYcwAB.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@ -236,15 +236,18 @@
|
||||
method: "POST",
|
||||
body: JSON.stringify({ body })
|
||||
});
|
||||
let message = data.message;
|
||||
if (pendingUpload) {
|
||||
const upload = pendingUpload;
|
||||
await api(`/api/messages/${data.message.id}/attachments`, {
|
||||
method: "POST",
|
||||
body: JSON.stringify({ upload_id: pendingUpload.id })
|
||||
body: JSON.stringify({ upload_id: upload.id })
|
||||
});
|
||||
pendingUpload = null;
|
||||
message = { ...message, attachments: [...(message.attachments || []), upload] };
|
||||
}
|
||||
if (!messages.some((message) => message.id === data.message.id)) {
|
||||
messages = [...messages, data.message];
|
||||
if (!messages.some((existing) => existing.id === message.id)) {
|
||||
messages = [...messages, message];
|
||||
}
|
||||
await scrollMessagesToBottom();
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user