Fix: Handle Undefined Window in getOrigin to Prevent SSR Errors - #8878
Fix: Handle Undefined Window in getOrigin to Prevent SSR Errors#8878tmdeveloper007 wants to merge 1 commit into
Conversation
|
This pull request addresses the issue of SSR errors by ensuring that the |
Aamod007
left a comment
There was a problem hiding this comment.
Great fix for SSR compatibility! Creating a dedicated \�rowserOrigin\ variable with strict checks (\ ypeof window !== 'undefined' && window != null) in \utils/urls.ts\ makes the \getOrigin\ function much safer for server-side environments like Next.js. The logic is clean and easy to follow. Approved!
|
If you are still working on this, please push your latest changes or leave a comment to keep it active. |
Summary of What Has Been Done
Refactored
getOriginto use an explicit guard for browser context. Thewindow.location.originaccess is now isolated with explicittypeof window !== 'undefined'andwindow != nullchecks.Changes Made
utils/urls.ts: RefactoredgetOriginwith explicit browser context guardImpact it Made
Closes #8846
Note: Please assign this PR to the
tmdeveloper007account.