Bindu
Bindu copied to clipboard
Move Server Hook Code Out of Build-Time Path
π Overview
This PR refactors the server hook logic by removing build-time guarded code and relocating it to the appropriate SvelteKit server lifecycle hook.
Previously, the logic in hooks.server.ts relied on a building flag to prevent execution during build time. This approach is not ideal and was marked with a TODO for improvement.
π Whatβs Changed
- β Identified the correct SvelteKit server lifecycle hook for runtime execution
- β Moved server-start logic out of the build-time guarded block
- β
Removed dependency on the
buildingflag - β
Cleaned up and simplified
hooks.server.ts
π Files Modified
frontend/src/hooks.server.ts(around line 42)
π§ Why This Matters
- Ensures proper separation between build-time and runtime logic
- Aligns with SvelteKit best practices
- Improves maintainability and readability of server hooks
- Prevents unintended execution during build phase
π§ͺ Testing
- Verified server starts correctly without build-time execution
- Confirmed no regression in existing functionality
π Request
Kindly review and assign this issue to me if everything looks good. Happy to make any changes if needed!
π Notes
If there are additional lifecycle hooks or patterns preferred in this project, please let me know for alignment.
Closes #347