Skip to content

Commit

Permalink
chore: update socket
Browse files Browse the repository at this point in the history
  • Loading branch information
ynwd committed Nov 29, 2024
1 parent 442a925 commit 5839374
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
2 changes: 1 addition & 1 deletion deno.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"nodeModulesDir": "auto",
"tasks": {
"start": "ENV=DEVELOPMENT deno run -r --env --unstable-kv -A --watch modules/app/main.ts --debug",
"start": "ENV=DEVELOPMENT deno run --env --unstable-kv -A --watch modules/app/main.ts --debug",
"build": "deno run --env -A --unstable-kv modules/app/main.ts --build ",
"prod": "deno run --env --unstable-kv -A modules/app/main.ts",
"test": "rm -rf .hydrate && rm -rf cov && deno test --env --unstable-kv -A --coverage=cov && deno coverage cov",
Expand Down
3 changes: 1 addition & 2 deletions modules/hook/socket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ const useWebSocket = (url: string, room: string, user: string) => {
...data,
}),
);
countRef.current++;
return console.log(`WebSocket connection established: ${room}`);
return countRef.current++;
}

console.log(`WebSocket connection closed: ${room}`);
Expand Down
12 changes: 2 additions & 10 deletions modules/index/index.room.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,7 @@ export function Room(
const state = useContext(AppContext);
const { data } = useFetch(`/api/room/${props.id}`);

const handleChange = (
e: JSX.TargetedEvent<HTMLInputElement, InputEvent>,
) => {
const handleChange = (e: JSX.TargetedEvent<HTMLInputElement, InputEvent>) => {
const target = e.target as HTMLInputElement;
setSelected(target.value);
state.room.value = data as {
Expand All @@ -33,13 +31,7 @@ export function Room(
name="room"
type="radio"
value={props.id}
onInput={(e) =>
handleChange(
e as JSX.TargetedEvent<
HTMLInputElement,
InputEvent
>,
)}
onChange={handleChange}
checked={selected === props.id}
disabled={props.disabled}
class="w-4 h-4 text-blue-600 bg-gray-100 focus:ring-blue-600 ring-offset-gray-700 focus:ring-offset-gray-700 focus:ring-2 border-gray-500"
Expand Down

0 comments on commit 5839374

Please sign in to comment.