Skip to content

Commit

Permalink
fix: Add updateRoomSettings handler to Setting component
Browse files Browse the repository at this point in the history
  • Loading branch information
rhino-ty committed Dec 4, 2024
1 parent 870edbc commit 320046f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions client/src/components/setting/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const Setting = memo(({ className, ...props }: HTMLAttributes<HTMLDivElement>) =
// 개별 selector로 필요한 상태만 구독
const roomSettings = useGameSocketStore((state) => state.roomSettings);
const isHost = useGameSocketStore((state) => state.isHost);
const actions = useGameSocketStore((state) => state.actions);

const [selectedValues, setSelectedValues] = useState<RoomSettings>(
roomSettings ?? {
Expand All @@ -46,6 +47,7 @@ const Setting = memo(({ className, ...props }: HTMLAttributes<HTMLDivElement>) =
void gameSocketHandlers.updateSettings({
settings: { ...selectedValues, drawTime: selectedValues.drawTime + 5 },
});
actions.updateRoomSettings(selectedValues);
}, [selectedValues, isHost]);

const handleSettingChange = useCallback((key: keyof RoomSettings, value: string) => {
Expand Down

0 comments on commit 320046f

Please sign in to comment.