Skip to content

Commit

Permalink
fix: prevent rerendering in ChannelTalk
Browse files Browse the repository at this point in the history
  • Loading branch information
yougyung committed Sep 26, 2024
1 parent 2b2b75e commit decf073
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions app/utils/global/channel-talk.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
'use client';
import * as ChannelService from '@channel.io/channel-web-sdk-loader';
import { useEffect } from 'react';

export default function ChannelTalk() {
if (typeof window !== 'undefined') {
ChannelService.loadScript();
ChannelService.boot({
pluginKey: process.env.NEXT_PUBLIC_CHANNELTALK_PLUGIN ?? '',
});
}
useEffect(() => {
if (typeof window !== 'undefined') {
ChannelService.loadScript();
ChannelService.boot({
pluginKey: process.env.NEXT_PUBLIC_CHANNELTALK_PLUGIN ?? '',
});
}
}, []);
return <></>;
}

0 comments on commit decf073

Please sign in to comment.