fix: lazy-compile server fn on dev restart to avoid invalid ID error#6655
fix: lazy-compile server fn on dev restart to avoid invalid ID error#6655schiller-manuel merged 1 commit intomainfrom
Conversation
📝 WalkthroughWalkthroughThis change implements runtime lazy-validation for server function IDs in development mode. When a server function ID isn't immediately registered, the handler now decodes the base64url-encoded ID to extract file and export information, fetches the module to trigger compilation, then re-checks the registry. Changes
Sequence DiagramsequenceDiagram
participant Client
participant Handler as Dev Handler
participant Registry as serverFnsById
participant Decoder as Base64 Decoder
participant Resolver as Path Resolver
participant Loader as Module Loader
Client->>Handler: Request with server function ID
Handler->>Registry: Check if ID is registered
alt ID Found
Registry-->>Handler: Return function
Handler-->>Client: Success
else ID Not Found
Handler->>Decoder: Decode base64url ID
alt Decode Success
Decoder-->>Handler: Extract file & export
Handler->>Resolver: Resolve to absolute path
Resolver-->>Handler: Return absolute path
Handler->>Loader: Fetch module (trigger compilation)
Loader-->>Handler: Module loaded
Handler->>Registry: Re-check registry
alt Now Registered
Registry-->>Handler: Return function
Handler-->>Client: Success
else Still Missing
Handler-->>Client: Error - function not found
end
else Decode/Fetch Fails
Handler-->>Client: Error - invalid ID
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
⚔️ Resolve merge conflicts (beta)
No actionable comments were generated in the recent review. 🎉 🧹 Recent nitpick comments
Comment |
|
View your CI Pipeline Execution ↗ for commit 4a3ed02
☁️ Nx Cloud last updated this comment at |
fixes #6609
Summary by CodeRabbit