Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion packages/chatkit-react/src/ChatKit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ export const ChatKit = React.forwardRef<OpenAIChatKit, ChatKitProps>(
const ref = React.useRef<OpenAIChatKit | null>(null);

React.useLayoutEffect(() => {
if (!ref.current) return;
const el = ref.current;
if (!el) return;

// Fast path: element is already defined
if (customElements.get('openai-chatkit')) {
Expand All @@ -45,6 +45,8 @@ export const ChatKit = React.forwardRef<OpenAIChatKit, ChatKitProps>(
return (
<openai-chatkit
ref={(chatKit) => {
ref.current = chatKit;

control.setInstance(chatKit);

if (typeof forwardedRef === 'function') {
Expand Down