@littlepartytime/dev-kit 1.15.0 → 1.15.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,10 +28,16 @@ export default function Play() {
28
28
  }, []);
29
29
 
30
30
  // Auto-join: connect immediately with server-assigned name
31
+ // Use sessionStorage to persist identity across HMR reconnects
31
32
  useEffect(() => {
32
33
  if (!isAutoMode) return;
33
34
 
34
- const sock = io('http://localhost:4001', { query: { auto: 'true' } });
35
+ const stored = sessionStorage.getItem('lpt-player');
36
+ const query = stored
37
+ ? { nickname: JSON.parse(stored).nickname }
38
+ : { auto: 'true' };
39
+
40
+ const sock = io('http://localhost:4001', { query });
35
41
 
36
42
  sock.on('connect', () => {
37
43
  setMyId(sock.id);
@@ -41,6 +47,7 @@ export default function Play() {
41
47
  sock.on('player:assigned', ({ id, nickname: assignedName }: { id: string; nickname: string }) => {
42
48
  setMyPlayerId(id);
43
49
  setNickname(assignedName);
50
+ sessionStorage.setItem('lpt-player', JSON.stringify({ id, nickname: assignedName }));
44
51
  });
45
52
 
46
53
  sock.on('room:update', (r: any) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@littlepartytime/dev-kit",
3
- "version": "1.15.0",
3
+ "version": "1.15.1",
4
4
  "description": "Development toolkit CLI for Little Party Time game developers",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",