Skip to content

Enhance useTemplates Hook for SSR Compatibility in Custom Templates Component#151

Merged
Ashad001 merged 2 commits intoFireBird-Technologies:mainfrom
Ashad001:feat/custom-agents
Jun 13, 2025
Merged

Enhance useTemplates Hook for SSR Compatibility in Custom Templates Component#151
Ashad001 merged 2 commits intoFireBird-Technologies:mainfrom
Ashad001:feat/custom-agents

Conversation

@Ashad001
Copy link
Contributor

This pull request introduces improvements to the useTemplates function in auto-analyst-frontend/components/custom-templates/useTemplates.ts to ensure compatibility with server-side rendering (SSR). The changes primarily involve adding checks for the window object to prevent errors when running in non-browser environments.

Enhancements for SSR compatibility:

  • Added a check to verify typeof window !== 'undefined' before dispatching the template-preferences-updated event, ensuring the code doesn't break in SSR environments. [1] [2]
  • Added a check to verify typeof window === 'undefined' before setting up the useEffect listener for external updates, preventing unnecessary operations during SSR.

@Ashad001 Ashad001 added the bug fix Used for tracking and categorizing fixes for reported bugs and issues in the codebase. label Jun 13, 2025
@Ashad001 Ashad001 merged commit 0217498 into FireBird-Technologies:main Jun 13, 2025
1 check passed
ArslanS1997 pushed a commit that referenced this pull request Mar 17, 2026
Enhance useTemplates Hook for SSR Compatibility in Custom Templates Component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix Used for tracking and categorizing fixes for reported bugs and issues in the codebase.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant