Bug Report: Runtime Error in tawkSwitchWidget
Summary
A critical issue was identified in the TawkMessenger component that can cause a runtime error when calling tawkSwitchWidget.
Issue Details
Parameter mismatch in tawkSwitchWidget method
- Location:
useImperativeHandle, line 144
- Method:
tawkSwitchWidget
Current Implementation
tawkSwitchWidget: (options, callback) => {
window.Tawk_API.switchWidget(data, callback);
}
Problem
The variable data is referenced but never defined within the scope of this method. This results in undefined being passed to switchWidget, causing a runtime error.
Based on the method signature, options is clearly intended to be passed instead.
Expected Behavior
The options parameter should be forwarded to window.Tawk_API.switchWidget.
Suggested Fix
tawkSwitchWidget: (options, callback) => {
window.Tawk_API.switchWidget(options, callback);
}
Impact
- Causes runtime errors when
tawkSwitchWidget is invoked
- Breaks widget switching functionality
- Can crash consumer applications depending on error handling
Bug Report: Runtime Error in
tawkSwitchWidgetSummary
A critical issue was identified in the
TawkMessengercomponent that can cause a runtime error when callingtawkSwitchWidget.Issue Details
Parameter mismatch in
tawkSwitchWidgetmethoduseImperativeHandle, line 144tawkSwitchWidgetCurrent Implementation
Problem
The variable
datais referenced but never defined within the scope of this method. This results inundefinedbeing passed toswitchWidget, causing a runtime error.Based on the method signature,
optionsis clearly intended to be passed instead.Expected Behavior
The
optionsparameter should be forwarded towindow.Tawk_API.switchWidget.Suggested Fix
Impact
tawkSwitchWidgetis invoked