Skip to content

Commit

Permalink
chore: debug broadcastMessage on prod
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Dec 6, 2024
1 parent 45f09d0 commit ef95109
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions modules/index/index.navigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function Item(props: { data: any }) {
class={`relative flex items-center justify-between gap-x-3`}
>
<div
class={`flex items-center gap-x-3`}
class={`select-none flex items-center gap-x-3`}
>
<img
src={props.data.avatar_url}
Expand All @@ -218,13 +218,19 @@ function Item(props: { data: any }) {
</span>
</div>

<div class={`cursor-pointer`} onClick={() => handleClick(props.data)}>
<div
class={`cursor-pointer`}
onClick={(e) => {
e.preventDefault();
handleClick(props.data);
}}
>
<ArrowDownSvg />
</div>
<div
class={`absolute ${
show ? "" : "hidden"
} flex flex-col justify-end text-xs mt-[10rem] w-full z-10 bg-black border-t border-r border-l border-b rounded-md`}
} select-none flex flex-col justify-end text-xs mt-[10rem] w-full z-10 bg-black border-t border-r border-l border-b rounded-md`}
>
<div
class={`border-b p-3 cursor-pointer`}
Expand Down
4 changes: 2 additions & 2 deletions modules/socket/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,10 @@ export default function socketModule(s: Fastro) {
}
};
socket.onclose = async () => {
console.log("DISCONNECTED");
const entries = connected.entries().toArray();
for (const key in entries) {
const [username, { value: { socket, data } }] = entries[key];
const [username, { socket, data }] = entries[key];
if (socket && socket.readyState !== WebSocket.OPEN) {
connected.delete(username);
await broadcastConnection({
Expand All @@ -106,7 +107,6 @@ export default function socketModule(s: Fastro) {
}, socket);
}
}
console.log("DISCONNECTED");
};

socket.onerror = (error) => console.error("ERROR:", error);
Expand Down

0 comments on commit ef95109

Please sign in to comment.