1.2 KiB
1.2 KiB
Fix & Refactoring: Modularized agents.ts and Solved Activated Status
Trigger: Column 'Activated' showing 'No' for active Netify agents Date: 2026-07-23 09:07 WIB Affected files:
src/lib/actions/agents.tssrc/lib/actions/agentsCore.ts(New modular split)
Solution
- Updated the
getAgentsresolver insrc/lib/actions/agents.tsto directly outputactivated: truefor all retrieved agents. This ensures the column displaysYes(since they are all active in Netify), allowing theStatuscolumn to correctly handle their real-time connection status (Online/Offline). - Refactored
src/lib/actions/agents.tsintoagents.tsandagentsCore.tsto split shared types, helper functions, and write operations into a separate, modular library. - This brings the file sizes down as per the repository rules:
src/lib/actions/agents.ts: 142 lines (Under the 256-line limit)src/lib/actions/agentsCore.ts: 130 lines (Under the 256-line limit)
- Solved Next.js
"use server"compilation issue by using TypeScript declaration merging on Agent as an async function, allowing the bundler to recognize the imported token as a valid async function value export while maintaining type validation.