Skip to content

fix: guard typing indicator template against non-browser environments#89

Merged
sauravbhattacharya001 merged 1 commit intomasterfrom
cleanup/ssr-safety-and-consistency
Mar 28, 2026
Merged

fix: guard typing indicator template against non-browser environments#89
sauravbhattacharya001 merged 1 commit intomasterfrom
cleanup/ssr-safety-and-consistency

Conversation

@sauravbhattacharya001
Copy link
Copy Markdown
Owner

Code cleanup: SSR safety and consistency

Changes

  1. SSR crash fix - _typingIndicatorTemplate was created via an IIFE that calls document.createElement unconditionally at bundle load time. In SSR/Node environments, this would throw a ReferenceError. Now guarded with typeof document !== 'undefined'.

  2. let to var consistency - The typing template was the only file using let while the entire codebase uses var for ES5 compatibility.

  3. Misleading comment - init.js comment said "Workflow Builder init" but it initializes 4 modules. Updated to be accurate.

No breaking changes

Backward compatible - the template is still eagerly created in browser environments and the public API is unchanged.

- _typingIndicatorTemplate IIFE would crash at load time in SSR/Node
  contexts where 'document' is undefined. Now guarded with typeof check,
  returning null in non-browser environments.
- Fixed 'let' → 'var' for codebase consistency (all other modules use var).
- Fixed misleading comment in init.js (handles 4 modules, not just
  WorkflowBuilder).
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions github-actions Bot added app Core application changes frontend Frontend/UI changes labels Mar 27, 2026
@sauravbhattacharya001 sauravbhattacharya001 merged commit 04247c0 into master Mar 28, 2026
3 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app Core application changes frontend Frontend/UI changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant