update other things from backend changes

This commit is contained in:
2026-04-21 21:45:46 -04:00
parent 2bc7da8028
commit 5933b43cd3
3 changed files with 13 additions and 17 deletions
+4 -9
View File
@@ -19,17 +19,12 @@
});
$effect(() => {
const status = chat.joinServerStatus;
const status = chat.reducerStatus;
// Only update if the status is for this server
if (status?.status === "invite_created" && status.error) {
const statusServerId = status.serverId?.toString();
const currentServerId = chat.activeServerId?.toString();
console.log(`[InviteModal] Received code. Comparing: ${statusServerId} === ${currentServerId}`);
if (statusServerId === currentServerId) {
inviteCode = status.error;
}
if (status?.status === "success" && status.reducerName === "create_invite" && status.error) {
// In the backend, we use report_success_with_payload for invites
inviteCode = status.error;
}
});
+1 -1
View File
@@ -272,7 +272,7 @@
{/if}
{#each visibleMessages as msg, i (msg.id.toString())}
{@const isHighlighted = (chat.pendingThreadParentMessageId === msg.id) || (chat.activeThread?.parentMessageId === msg.id)}
{@const isHighlighted = (chat.pendingThreadParentMessageId === msg.id) || (chat.activeThreadId === msg.id)}
<MessageItem
{msg}
prevMsg={i > 0 ? visibleMessages[i-1] : null}
+8 -7
View File
@@ -28,22 +28,23 @@
$effect(() => {
if (!isJoining) return;
const status = chat.joinServerStatus;
console.log("[Discovery] joinServerStatus updated:", status);
const status = chat.reducerStatus;
if (status?.reducerName !== "join_server") return;
if (status?.status === "error") {
if (status.status === "error") {
joinError = status.error || "Failed to join server";
isJoining = false; // Attempt finished with error
} else if (status?.status === "success") {
} else if (status.status === "success") {
console.log("[Discovery] Join SUCCESS recorded.");
joinError = null;
inviteCode = "";
isJoining = false; // Attempt finished with success
// Navigate to the joined server
if (status.serverId) {
console.log(`[Discovery] Success! Navigating to server ${status.serverId}`);
chat.activeServerId = status.serverId;
if (status.error) {
const serverId = BigInt(status.error);
console.log(`[Discovery] Success! Navigating to server ${serverId}`);
chat.activeServerId = serverId;
}
chat.showDiscoveryModal = false;