Urgent Full Stack Debugging: React/Node.js/TypeScript

Job ID: 40017053

Budget: $250 – $750 USD

I am seeking an experienced and highly skilled Full Stack Developer (React/Node.js/TypeScript) for an urgent contract focused on resolving a critical application bug and implementing architectural improvements to enhance system robustness for high concurrency.
About the Project: Co-Creative Pilot
This application is a live pilot study for a co-creative experiment. It runs a turn-based word association task where human participants interact with a partner (either an AI service or another human via a real-time connection) to collaboratively generate word chains.
The Tech Stack:
* Frontend: React, TypeScript, Wouter (routing), Tailwind CSS.
* Backend: Node.js, Express.
* Real-time: WebSockets (custom implementation for pairing participants).
* Database: PostgreSQL with Drizzle ORM.
The Critical Issue (Race Condition Bug)
The application currently fails when transitioning between rounds, which severely limits concurrent usage and stability:
* The Behavior: In the second round (Trial 2), the app correctly cues the new round but immediately "skips" ahead to Turn 2, displaying the stale partner response data from the previous round (Trial 1) instead of waiting for a new input.
Deliverables and Action Items
Your primary goal is to make the application robust and reliable for live data collection with multiple concurrent users. You will:
* Review Codebase: Diagnose the data flow within the word-task.tsx component and the pairingSocket.tsx WebSocket logic.
* Implement Fix: Implement rigorous state guards (e.g., checking runId and currentTrialIndex) within all asynchronous functions and WebSocket listeners to prevent stale data from the previous run from corrupting the current run's state.
* Ensure Robustness: Deliver a solution that not only fixes the reported bug but makes the application logic resilient against network latency and unexpected message ordering, supporting higher concurrent traffic.
* Verify Synchronization: Ensure that all turn-taking logic and round transitions are strictly synchronized and isolated between independent runs.
Requirements
* Strong proficiency in React (Hooks, Refs, State Management) and TypeScript is non-negotiable.
* Expertise in WebSockets and designing logic that is immune to asynchronous race conditions.
* A proven track record of developing or debugging applications designed for multiple concurrent users and real-time data integrity.
* Ability to jump into an existing codebase and deliver a targeted, clean, and tested solution quickly.