refactor: component cleanup

This commit is contained in:
Shivam Mishra
2025-06-10 16:29:33 +05:30
parent c8cc157683
commit d289daf6ca
2 changed files with 12 additions and 9 deletions
@@ -13,8 +13,8 @@ export const ChatwootConversation = ({
// Ensure we're inside a ChatwootProvider
useChatwoot(); // This will throw if not in Provider context
const [isLoaded, setIsLoaded] = useState(false);
const [error, setError] = useState(null);
const [, setIsLoaded] = useState(false);
const [, setError] = useState(null);
// Validate required props
if (!conversationId) {
@@ -27,11 +27,14 @@ export const ChatwootConversation = ({
onLoad?.();
}, [onLoad]);
const handleError = useCallback((err) => {
setError(err.message);
setIsLoaded(false);
onError?.(err);
}, [onError]);
const handleError = useCallback(
err => {
setError(err.message);
setIsLoaded(false);
onError?.(err);
},
[onError]
);
return (
<div
@@ -40,7 +43,7 @@ export const ChatwootConversation = ({
height: '100%',
width: '100%',
position: 'relative',
...style
...style,
}}
>
<ChatwootMessageListWrapper
@@ -17,7 +17,7 @@ const error = ref(null);
async function waitForGlobalInitialization() {
// Wait for global Chatwoot objects to be available
let attempts = 0;
const maxAttempts = 50; // 5 seconds max wait
const maxAttempts = 5000; // 5 seconds max wait
while (attempts < maxAttempts) {
// eslint-disable-next-line no-underscore-dangle