Compare commits

..

2 Commits

Author SHA1 Message Date
semantic-release-bot
8f3dd9ec92 chore(release): 2.4.4 [skip ci]
## [2.4.4](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.4.3...v2.4.4) (2025-10-08)

### Bug Fixes

* correctly access getSocketIO from dynamic import ([30abf33](30abf33ee8))
2025-10-08 13:57:35 +00:00
Thomas Hallock
30abf33ee8 fix: correctly access getSocketIO from dynamic import
The dynamic import returns a module namespace object, so we need to
access socketServerModule.getSocketIO() rather than treating the
module itself as the function.

Simplified the wrapper to directly cache and use the module, checking
that getSocketIO exists before calling it.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-08 08:56:47 -05:00
3 changed files with 33 additions and 25 deletions

View File

@@ -1,3 +1,10 @@
## [2.4.4](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.4.3...v2.4.4) (2025-10-08)
### Bug Fixes
* correctly access getSocketIO from dynamic import ([30abf33](https://github.com/antialias/soroban-abacus-flashcards/commit/30abf33ee86b36f2a98014e5b017fa8e466a2107))
## [2.4.3](https://github.com/antialias/soroban-abacus-flashcards/compare/v2.4.2...v2.4.3) (2025-10-08)

View File

@@ -6,34 +6,35 @@
import type { Server as SocketIOServerType } from 'socket.io'
// Import the socket server module (this is safe because it's only used in Node.js context)
let socketServer: { getSocketIO: () => SocketIOServerType | null } | null = null
// Lazy-load the socket server module (only works on server-side)
async function loadSocketServer() {
if (typeof window !== 'undefined') {
// Client-side: return null
return null
}
if (!socketServer) {
try {
// Dynamic import to avoid bundling issues
socketServer = await import('../../socket-server')
} catch (error) {
console.error('[Socket IO] Failed to load socket server:', error)
return null
}
}
return socketServer
}
// Cache for the socket server module
let socketServerModule: any = null
/**
* Get the socket.io server instance
* Returns null if not initialized or if called on client-side
*/
export async function getSocketIO(): Promise<SocketIOServerType | null> {
const server = await loadSocketServer()
return server ? server.getSocketIO() : null
// Client-side: return null
if (typeof window !== 'undefined') {
return null
}
// Lazy-load the socket server module on first call
if (!socketServerModule) {
try {
// Dynamic import to avoid bundling issues
socketServerModule = await import('../../socket-server')
} catch (error) {
console.error('[Socket IO] Failed to load socket server:', error)
return null
}
}
// Call the exported getSocketIO function from the module
if (socketServerModule && typeof socketServerModule.getSocketIO === 'function') {
return socketServerModule.getSocketIO()
}
console.warn('[Socket IO] getSocketIO function not found in socket-server module')
return null
}

View File

@@ -1,6 +1,6 @@
{
"name": "soroban-monorepo",
"version": "2.4.3",
"version": "2.4.4",
"private": true,
"description": "Beautiful Soroban Flashcard Generator - Monorepo",
"workspaces": [